...

Package keywrap

import "github.com/ProtonMail/go-crypto/openpgp/aes/keywrap"
Overview
Index

Overview ▾

Package keywrap is an implementation of the RFC 3394 AES key wrapping algorithm. This is used in OpenPGP with elliptic curve keys.

Variables

var (
    // ErrWrapPlaintext is returned if the plaintext is not a multiple
    // of 64 bits.
    ErrWrapPlaintext = errors.New("keywrap: plainText must be a multiple of 64 bits")

    // ErrUnwrapCiphertext is returned if the ciphertext is not a
    // multiple of 64 bits.
    ErrUnwrapCiphertext = errors.New("keywrap: cipherText must by a multiple of 64 bits")

    // ErrUnwrapFailed is returned if unwrapping a key fails.
    ErrUnwrapFailed = errors.New("keywrap: failed to unwrap key")

    // ErrInvalidKey is returned when the AES key is invalid.
    ErrInvalidKey = errors.New("keywrap: invalid AES key")
)

func Unwrap

func Unwrap(key, cipherText []byte) ([]byte, error)

Unwrap a key using the RFC 3394 AES Key Wrap Algorithm.

func Wrap

func Wrap(key, plainText []byte) ([]byte, error)

Wrap a key using the RFC 3394 AES Key Wrap Algorithm.