Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCEKMismatch = errors.New("invalid CEK size: must match the sum of the encryption and MAC key sizes") ErrInvalidCipherText = errors.New("invalid ciphertext") )
Functions ¶
func DecryptAESCBC ¶
DecryptAESCBC decrypts the payload using AES-CBC with the given parameters. It returns the decrypted payload.
func DecryptAESGCM ¶
DecryptAESGCM decrypts the payload using AES-GCM. It returns the decrypted payload.
Types ¶
type AESPayload ¶
type AESPayload struct { // E is the encrypted data. E []byte // T is the authentication tag. T []byte }
AESPayload represents the result of an AES encryption.
func EncryptAESCBC ¶
func EncryptAESCBC(payload, additionalData []byte, key *jwkcore.AESKeySet) (*AESPayload, error)
EncryptAESCBC encrypts the payload using AES-CBC with the given parameters. It returns (in order) the encrypted payload and the authentication tag.
Additional data is an optional parameter that can be used to pass unencrypted data to the payload.
func EncryptAESGCM ¶
func EncryptAESGCM(payload, additionalData []byte, key *jwkcore.AESKeySet) (*AESPayload, error)
EncryptAESGCM encrypts the payload using AES-GCM. It returns (in order) the encrypted payload and the authentication tag.
Additional data is an optional parameter that can be used to pass unencrypted data to the payload.