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
Algorithm πPolicy - Policy for resolving and validating a COSE messageβs content-encryption algorithm.
- 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 - Resolves the content-encryption algorithm according to
policy. - decrypt_
cose π - Authenticates and decrypts a multi-recipient COSE [
CoseEncrypt] message. - decrypt_
cose0 π - Authenticates and decrypts a single-recipient COSE [
CoseEncrypt0] message. - decrypt_
xaes256_ πgcm - Decrypts a typed COSE Encrypt0 message with an XAES-256-GCM key.
- 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_
xaes256_ πgcm - Encrypts plaintext with XAES-256-GCM and returns a typed COSE Encrypt0 message.
- 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