Skip to main content

Module symmetric

Module symmetric 

Source
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Β§

CoseAlgorithmPolicy πŸ”’
Policy for resolving and validating a COSE message’s content-encryption algorithm.
CoseContentEncryptionAlgorithm πŸ”’
The content-encryption algorithms that can seal the body of a COSE message.

ConstantsΒ§

TEXT_PAD_BLOCK_SIZE πŸ”’

TraitsΒ§

CoseEncryptCipher πŸ”’
Encrypts and decrypts the content of COSE [CoseEncrypt]/[CoseEncrypt0] messages with an Aead cipher, 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 plaintext into a multi-recipient COSE [CoseEncrypt] message, dispatching to the CoseEncryptCipher selected by algorithm.
encrypt_cose0 πŸ”’
Encrypts plaintext into a single-recipient COSE [CoseEncrypt0] message, dispatching to the CoseEncryptCipher selected by algorithm.
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 header declares a content-encryption algorithm, it matches C’s.
should_pad_content πŸ”’