Expand description
The public-encryption primitive kind: asymmetric encryption. Anyone
holding the public key encrypts; only the private-key holder decrypts.
The dominant use is key transport — wrapping a symmetric key to a
recipient — so the wrap operations sit beside encrypt/decrypt, riding
the same provider-held intermediates as the key-wrap kind (see the
wrapping interface).
Operations take and return whole byte lists rather than streams — the
one kind that does. The plaintext is bounded by the key (for RSA-OAEP,
the modulus length minus the padding overhead), so there is no
unbounded data to stream; a payload above the bound fails with the
named extension condition on encrypt/wrap.
Security:
- Encryption is randomized: encrypting one plaintext twice yields different ciphertexts, and both decrypt.
decryptandunwrapfail with one detail-free error (error.authentication-failed): a wrong-length ciphertext, damaged padding, and a mismatched label are indistinguishable, as RFC 8017 requires — a distinguishable verdict is a padding-oracle amplifier.
Structs§
- Decryption
Key - A private key.
decryptandunwrapare one-shot on the immutable key; the extractability contract inREADME.mdapplies. - Decryption
KeyOptions - Mint-time policy for
decryption-keys, following the package-wide options contract (seeREADME.md). The two grants separate disclosure from minting:decryptreturns plaintext to the caller, whileunwrapmints keys whose material the caller never sees — a key granted onlycan-unwrapcannot leak what it transports (thederive-bits/derive-keysplit’s reasoning). - Encryption
Key - A public key: encryption and wrapping, secret-free to hold.