module
JOSE::JWA::RSA_KW
Overview
RSA key transport — RFC 7518 §4.1–4.3. All methods accept a raw LibCryptoJose::RSA pointer (no JWK awareness). Callers are responsible for freeing the RSA key.
Defined in:
jose/jwa/rsa_kw.crClass Method Summary
-
.decrypt(rsa : LibCryptoJose::RSA, ciphertext : Bytes, mode : Symbol) : Bytes
Decrypts ciphertext with the given RSA private key.
-
.encrypt(rsa : LibCryptoJose::RSA, plaintext : Bytes, mode : Symbol) : Bytes
Encrypts plaintext with the given RSA public key.
Class Method Detail
def self.decrypt(rsa : LibCryptoJose::RSA, ciphertext : Bytes, mode : Symbol) : Bytes
#
Decrypts ciphertext with the given RSA private key.
mode must match the mode used during encryption (see .encrypt).
Returns the decrypted plaintext bytes.
def self.encrypt(rsa : LibCryptoJose::RSA, plaintext : Bytes, mode : Symbol) : Bytes
#
Encrypts plaintext with the given RSA public key.
mode selects the padding scheme:
:oaep_sha1— RSAES-OAEP with SHA-1 (RFC 7518 §4.2,RSA-OAEP):oaep_sha256— RSAES-OAEP with SHA-256 (RFC 7518 §4.3,RSA-OAEP-256):pkcs1— RSAES-PKCS1-v1_5 (RFC 7518 §4.1,RSA1_5)
Returns the encrypted key bytes.