Expand description
COSE symmetric encryption โ the middle layer of the three-layer stack:
- Lowest: Hazmat primitive (
crate::hazmat::symmetric_encryption) - Mid: COSE framing (this module)
- High: Consumer (
crate::safe,EncString)
Enumsยง
- Cose
Content ๐Encryption Algorithm - The content-encryption algorithms that can seal the body of a COSE message.
Constantsยง
- TEXT_
PAD_ ๐BLOCK_ SIZE
Traitsยง
- Cose
Encrypt ๐Cipher - Encrypts and decrypts the content of COSE [
CoseEncrypt]/[CoseEncrypt0] messages with anAeadcipher, using the cipherโs key as the content-encryption key (CEK).
Functionsยง
- algorithm_
from_ ๐header - Recovers the content-encryption algorithm declared in a messageโs protected header, falling back
to
default_algorithmwhen the header omits one. - decrypt_
cose ๐ - Authenticates and decrypts a multi-recipient COSE [
CoseEncrypt] message, dispatching to theCoseEncryptCipherindicated by the content-encryption algorithm declared in the messageโs protected header. - decrypt_
cose0 ๐ - Authenticates and decrypts a single-recipient COSE [
CoseEncrypt0] message, dispatching to theCoseEncryptCipherindicated by the content-encryption algorithm declared in the messageโs protected header. - decrypt_
xchacha20_ ๐poly1305 - Decrypts a COSE Encrypt0 message using a XChaCha20Poly1305 key.
- encrypt_
cose ๐ - Encrypts
plaintextinto a multi-recipient COSE [CoseEncrypt] message, dispatching to theCoseEncryptCipherselected byalgorithm. - encrypt_
cose0 ๐ - Encrypts
plaintextinto a single-recipient COSE [CoseEncrypt0] message, dispatching to theCoseEncryptCipherselected byalgorithm. - encrypt_
xchacha20_ ๐poly1305 - Encrypts a plaintext message using XChaCha20Poly1305 and returns a COSE Encrypt0 message.
- ensure_
algorithm_ ๐matches - Validates that, if the protected
headerdeclares a content-encryption algorithm, it matchesCโs. - should_
pad_ ๐content