41 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
50 const Integer & GetModulus()
const {
return m_n;}
51 const Integer & GetPublicExponent()
const {
return m_e;}
53 void SetModulus(
const Integer &n) {m_n = n;}
54 void SetPublicExponent(
const Integer &e) {m_e = e;}
88 {m_n = n; m_e = e; m_d = d; m_p = p; m_q = q; m_dp = dp; m_dq = dq; m_u = u;}
118 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
122 const Integer& GetPrime1()
const {
return m_p;}
123 const Integer& GetPrime2()
const {
return m_q;}
124 const Integer& GetPrivateExponent()
const {
return m_d;}
125 const Integer& GetModPrime1PrivateExponent()
const {
return m_dp;}
126 const Integer& GetModPrime2PrivateExponent()
const {
return m_dq;}
127 const Integer& GetMultiplicativeInverseOfPrime2ModPrime1()
const {
return m_u;}
129 void SetPrime1(
const Integer &p) {m_p = p;}
130 void SetPrime2(
const Integer &q) {m_q = q;}
131 void SetPrivateExponent(
const Integer &d) {m_d = d;}
132 void SetModPrime1PrivateExponent(
const Integer &dp) {m_dp = dp;}
133 void SetModPrime2PrivateExponent(
const Integer &dq) {m_dq = dq;}
134 void SetMultiplicativeInverseOfPrime2ModPrime1(
const Integer &u) {m_u = u;}
137 Integer m_d, m_p, m_q, m_dp, m_dq, m_u;
162 CRYPTOPP_STATIC_CONSTEXPR
const char*
CRYPTOPP_API StaticAlgorithmName() {
return "RSA";}
171template <
class STANDARD>
182template <
class STANDARD,
class H>
191 CRYPTOPP_STATIC_CONSTEXPR
const char*
CRYPTOPP_API StaticAlgorithmName() {
return "RSA-ISO";}
218#ifdef CRYPTOPP_DOXYGEN_PROCESSING
Classes and functions for working with ANS.1 objects.
Multiple precision integer with arithmetic operations.
RSA trapdoor function using the private key.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
RSA trapdoor function using the private key.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &e=17)
Create a RSA private key.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
Generate a random key or crypto parameters.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
void Initialize(const Integer &n, const Integer &e, const Integer &d, const Integer &p, const Integer &q, const Integer &dp, const Integer &dq, const Integer &u)
Initialize a RSA private key.
void Initialize(const Integer &n, const Integer &e, const Integer &d)
Initialize a RSA private key.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
void DEREncodePrivateKey(BufferedTransformation &bt) const
Encode privateKey part of privateKeyInfo.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
OID GetAlgorithmID() const
Retrieves the OID of the algorithm.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size)
Decode privateKey part of privateKeyInfo.
Interface for retrieving values given their names.
Template implementing constructors for public key algorithm classes.
Encodes and Decodes privateKeyInfo.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
RSAES<OAEP<SHA1>>::Decryptor typedef
RSAES<OAEP<SHA1>>::Encryptor typedef
RSAES<PKCS1v15>::Decryptor typedef
RSAES<PKCS1v15>::Encryptor typedef
RSA trapdoor function using the public key.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
RSA trapdoor function using the public key.
Integer ImageBound() const
Returns the maximum size of a representation after the trapdoor function is applied.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
OID GetAlgorithmID() const
Retrieves the OID of the algorithm.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size)
Decode subjectPublicKey part of subjectPublicKeyInfo.
void Initialize(const Integer &n, const Integer &e)
Initialize a RSA public key.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void DEREncodePublicKey(BufferedTransformation &bt) const
Encode subjectPublicKey part of subjectPublicKeyInfo.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
RSASS<PKCS1v15,SHA1>::Signer typedef
RSASS<PKCS1v15,SHA1>::Verifier typedef
Interface for random number generators.
Trapdoor Function (TF) encryption scheme.
Trapdoor Function (TF) Signature Scheme.
Applies the trapdoor function.
Applies the inverse of the trapdoor function.
RSASS<PKCS1v15, Weak::MD2>::Signer typedef
RSASS<PKCS1v15, Weak::MD2>::Verifier typedef
RSASS<PKCS1v15, Weak::MD5>::Signer typedef
RSASS<PKCS1v15, Weak::MD5>::Verifier typedef
Encodes and decodes subjectPublicKeyInfo.
#define CRYPTOPP_API
Win32 calling convention.
Abstract base classes that provide a uniform interface to this library.
Classes and functions for various padding schemes used in public key algorithms.
Multiple precision integer with arithmetic operations.
Crypto++ library namespace.
Namespace containing weak and wounded algorithms.
Classes for optimal asymmetric encryption padding.
Classes for PKCS padding schemes.
This file contains helper classes/functions for implementing public key algorithms.
RSA encryption algorithm.