Public-key encryption
Encrypt short messages to an RSA public key.
Each selector variant names an encryption scheme, for example
RSA.OAEP_SHA256. encrypt(public_key, plaintext) returns the ciphertext and
decrypt(private_key, ciphertext) returns the plaintext. Key generation,
loading and serialization are the same as for
RSA signatures, and the two modules share their key
objects.
RSA encryption handles one short message per call. To encrypt data, encrypt a random symmetric key with RSA and the data with an AEAD.
Failed OAEP decryption raises ValueError("decryption failed") without saying
which check failed. Other invalid parameters also raise ValueError, and
inputs of the wrong type raise TypeError.
Algorithms
- RSA RSAES-OAEP and legacy RSAES-PKCS1-v1_5 (RFC 8017).
Zeroization
Decrypted plaintext is copied into the returned bytes, which oxcrypto does
not wipe. The key objects and other limits are described under
signature zeroization.