Skip to main content

Module rsa

Module rsa 

Source
Expand description

Generic RSA implementation

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.
reduce_vartime πŸ”’
rsa_decrypt
⚠️ Performs raw RSA decryption with no padding or error checking.
rsa_decrypt_and_check
⚠️ Performs raw RSA decryption with no padding.
rsa_encrypt
⚠️ Raw RSA encryption of m with the public key. No padding is performed.
unblind πŸ”’
Given an m and unblinding factor, unblind the m.