package keywrap

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

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

Index

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")
)

Functions

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.

Source Files

keywrap.go

Version
v1.3.0 (latest)
Published
May 22, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
5 months ago

Tools for package owners.