15 NAMESPACE_BEGIN(CryptoPP)
27 OID GetAlgorithmID()
const;
33 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
38 Integer PreimageBound()
const {
return m_n;}
39 Integer ImageBound()
const {
return m_n;}
42 const Integer & GetModulus()
const {
return m_n;}
43 const Integer & GetPublicExponent()
const {
return m_e;}
45 void SetModulus(
const Integer &n) {m_n = n;}
46 void SetPublicExponent(
const Integer &e) {m_e = e;}
60 {m_n = n; m_e = e; m_d = d; m_p = p; m_q = q; m_dp = dp; m_dq = dq; m_u = u;}
73 OID GetAlgorithmID()
const {
return RSAFunction::GetAlgorithmID();}
84 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
88 const Integer& GetPrime1()
const {
return m_p;}
89 const Integer& GetPrime2()
const {
return m_q;}
90 const Integer& GetPrivateExponent()
const {
return m_d;}
91 const Integer& GetModPrime1PrivateExponent()
const {
return m_dp;}
92 const Integer& GetModPrime2PrivateExponent()
const {
return m_dq;}
93 const Integer& GetMultiplicativeInverseOfPrime2ModPrime1()
const {
return m_u;}
95 void SetPrime1(
const Integer &p) {m_p = p;}
96 void SetPrime2(
const Integer &q) {m_q = q;}
97 void SetPrivateExponent(
const Integer &d) {m_d = d;}
98 void SetModPrime1PrivateExponent(
const Integer &dp) {m_dp = dp;}
99 void SetModPrime2PrivateExponent(
const Integer &dq) {m_dq = dq;}
100 void SetMultiplicativeInverseOfPrime2ModPrime1(
const Integer &u) {m_u = u;}
103 Integer m_d, m_p, m_q, m_dp, m_dq, m_u;
110 Integer PreimageBound()
const {
return ++(m_n>>1);}
117 Integer PreimageBound()
const {
return ++(m_n>>1);}
123 static const char * CRYPTOPP_API StaticAlgorithmName() {
return "RSA";}
129 template <
class STANDARD>
136 template <
class STANDARD,
class H>
143 static const char * CRYPTOPP_API StaticAlgorithmName() {
return "RSA-ISO";}
virtual void AssignFrom(const NameValuePairs &source)=0
assign values from source to this object
virtual void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size)=0
decode privateKey part of privateKeyInfo, without the OCTET STRING header
void DEREncode(BufferedTransformation &bt) const
encode this object into a BufferedTransformation, using DER (Distinguished Encoding Rules) ...
void Load(BufferedTransformation &bt)
load key from a BufferedTransformation
This file contains various padding schemes for public key algorithms.
This file contains helper classes/functions for implementing public key algorithms.
encodes/decodes privateKeyInfo
void DEREncode(BufferedTransformation &bt) const
encode this object into a BufferedTransformation, using DER (Distinguished Encoding Rules) ...
interface for random number generators
virtual void DEREncodePrivateKey(BufferedTransformation &bt) const =0
encode privateKey part of privateKeyInfo, without the OCTET STRING header
void BERDecode(BufferedTransformation &bt)
decode this object from a BufferedTransformation, using BER (Basic Encoding Rules) ...
virtual bool Validate(RandomNumberGenerator &rng, unsigned int level) const =0
check this object for errors
void Save(BufferedTransformation &bt) const
save key into a BufferedTransformation
multiple precision integer and basic arithmetics
virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const =0
to be implemented by derived classes, users should use one of the above functions instead ...
void BERDecode(BufferedTransformation &bt)
decode this object from a BufferedTransformation, using BER (Basic Encoding Rules) ...
RSA signature scheme with appendix
Trapdoor Function Based Signature Scheme.
virtual void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms=g_nullNameValuePairs)
generate a random key or crypto parameters
Trapdoor Function Based Encryption Scheme.
encodes/decodes subjectPublicKeyInfo
interface for retrieving values given their names
A template implementing constructors for public key algorithm classes.