Skip to main content

Module rsa

Module rsa 

Source
Expand description

Shared integer arithmetic for RSAEP/RSAVP1 and RSADP/RSASP1 (RFC8017 §5).

These functions do not implement octet-string conversion or scheme encoding. In particular, rsa_encrypt performs modular exponentiation without checking the representative’s range; callers implementing RSAEP or RSAVP1 must establish that the input is less than n.

Functions§

blind 🔒
Returns the blinded c, along with the unblinding factor.
compute_modulus 🔒
Compute the modulus of a key from its primes.
compute_private_exponent_carmicheal 🔒
Compute the private exponent from its primes (p and q) and public exponent
compute_private_exponent_euler_totient 🔒
Compute the private exponent from its primes (p and q) and public exponent This uses Euler’s totient function
pow_mod_params 🔒
Computes base.pow_mod(exp, n) with precomputed n_params.
pow_mod_params_vartime_exp_bits 🔒
Computes base.pow_mod(exp, n) with a bounded exponent and precomputed n_params.
recover_primes
The following (deterministic) algorithm also recovers the prime factors p and q of a modulus n, given the public exponent e and private exponent d using the method described in NIST 800-56B Appendix C.2.
rsa_decrypt
⚠️ Performs the raw RSA private-key operation without padding or a CRT fault check.
rsa_decrypt_and_check
⚠️ Performs raw RSA decryption with no padding.
rsa_encrypt
⚠️ Raw RSA public-key operation on the integer representative m, without padding.
unblind 🔒
Given an m and unblinding factor, unblind the m.