Updated documentation (Issue 328)
parent
7cc8ad1a1d
commit
1b16a75352
54
eccrypto.h
54
eccrypto.h
|
|
@ -40,14 +40,33 @@ public:
|
|||
|
||||
virtual ~DL_GroupParameters_EC() {}
|
||||
|
||||
//! \brief Construct an EC GroupParameters
|
||||
DL_GroupParameters_EC() : m_compress(false), m_encodeAsOID(true) {}
|
||||
|
||||
//! \brief Construct an EC GroupParameters
|
||||
//! \param oid the OID of a curve
|
||||
DL_GroupParameters_EC(const OID &oid)
|
||||
: m_compress(false), m_encodeAsOID(true) {Initialize(oid);}
|
||||
|
||||
//! \brief Construct an EC GroupParameters
|
||||
//! \param ec the elliptic curve
|
||||
//! \param G the base point
|
||||
//! \param n the order of the base point
|
||||
//! \param k the cofactor
|
||||
DL_GroupParameters_EC(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero())
|
||||
: m_compress(false), m_encodeAsOID(true) {Initialize(ec, G, n, k);}
|
||||
|
||||
//! \brief Construct an EC GroupParameters
|
||||
//! \param bt BufferedTransformation with group parameters
|
||||
DL_GroupParameters_EC(BufferedTransformation &bt)
|
||||
: m_compress(false), m_encodeAsOID(true) {BERDecode(bt);}
|
||||
|
||||
//! \brief Initialize an EC GroupParameters using {EC,G,n,k}
|
||||
//! \param ec the elliptic curve
|
||||
//! \param G the base point
|
||||
//! \param n the order of the base point
|
||||
//! \param k the cofactor
|
||||
//! \details This Initialize() function overload initializes group parameters from existing parameters.
|
||||
void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero())
|
||||
{
|
||||
this->m_groupPrecomputation.SetCurve(ec);
|
||||
|
|
@ -55,6 +74,10 @@ public:
|
|||
m_n = n;
|
||||
m_k = k;
|
||||
}
|
||||
|
||||
//! \brief Initialize a DL_GroupParameters_EC {EC,G,n,k}
|
||||
//! \param oid the OID of a curve
|
||||
//! \details This Initialize() function overload initializes group parameters from existing parameters.
|
||||
void Initialize(const OID &oid);
|
||||
|
||||
// NameValuePairs
|
||||
|
|
@ -156,8 +179,19 @@ public:
|
|||
|
||||
virtual ~DL_PublicKey_EC() {}
|
||||
|
||||
//! \brief Initialize an EC Public Key using {GP,Q}
|
||||
//! \param params group parameters
|
||||
//! \param Q the public point
|
||||
//! \details This Initialize() function overload initializes a public key from existing parameters.
|
||||
void Initialize(const DL_GroupParameters_EC<EC> ¶ms, const Element &Q)
|
||||
{this->AccessGroupParameters() = params; this->SetPublicElement(Q);}
|
||||
|
||||
//! \brief Initialize an EC Public Key using {EC,G,n,Q}
|
||||
//! \param ec the elliptic curve
|
||||
//! \param G the base point
|
||||
//! \param n the order of the base point
|
||||
//! \param Q the public point
|
||||
//! \details This Initialize() function overload initializes a public key from existing parameters.
|
||||
void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q)
|
||||
{this->AccessGroupParameters().Initialize(ec, G, n); this->SetPublicElement(Q);}
|
||||
|
||||
|
|
@ -177,24 +211,37 @@ public:
|
|||
|
||||
virtual ~DL_PrivateKey_EC() {}
|
||||
|
||||
//! \brief Initialize an EC Private Key using {GP,x}
|
||||
//! \param params group parameters
|
||||
//! \param x the private exponent
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const DL_GroupParameters_EC<EC> ¶ms, const Integer &x)
|
||||
{this->AccessGroupParameters() = params; this->SetPrivateExponent(x);}
|
||||
|
||||
//! \brief Initialize an EC Private Key using {EC,G,n,x}
|
||||
//! \param ec the elliptic curve
|
||||
//! \param G the base point
|
||||
//! \param n the order of the base point
|
||||
//! \param x the private exponent
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x)
|
||||
{this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);}
|
||||
|
||||
//! \brief Create an EC private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param params the EC group parameters
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC<EC> ¶ms)
|
||||
{this->GenerateRandom(rng, params);}
|
||||
|
||||
//! \brief Create an EC private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param ec the elliptic curve
|
||||
//! \param G the base point
|
||||
//! \param n the cofactor
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \param n the order of the base point
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n)
|
||||
|
|
@ -325,7 +372,6 @@ struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMe
|
|||
{
|
||||
};
|
||||
|
||||
|
||||
//! \class ECIES
|
||||
//! \brief Elliptic Curve Integrated Encryption Scheme
|
||||
//! \tparam COFACTOR_OPTION \ref CofactorMultiplicationOption "cofactor multiplication option"
|
||||
|
|
|
|||
17
esign.h
17
esign.h
|
|
@ -23,6 +23,10 @@ class ESIGNFunction : public TrapdoorFunction, public ASN1CryptoMaterial<PublicK
|
|||
typedef ESIGNFunction ThisClass;
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Initialize a ESIGN public key with {n,e}
|
||||
//! \param n the modulus
|
||||
//! \param e the public exponent
|
||||
void Initialize(const Integer &n, const Integer &e)
|
||||
{m_n = n; m_e = e;}
|
||||
|
||||
|
|
@ -62,13 +66,20 @@ class InvertibleESIGNFunction : public ESIGNFunction, public RandomizedTrapdoorF
|
|||
typedef InvertibleESIGNFunction ThisClass;
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Initialize a ESIGN private key with {n,e,p,q}
|
||||
//! \param n modulus
|
||||
//! \param e public exponent
|
||||
//! \param p first prime factor
|
||||
//! \param q second prime factor
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q)
|
||||
{m_n = n; m_e = e; m_p = p; m_q = q;}
|
||||
|
||||
//! \brief Create a RSA private key
|
||||
//! \brief Create a ESIGN private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param modulusBits the size of the modulud, in bits
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
|
||||
|
|
@ -133,7 +144,7 @@ struct P1363_EMSA5 : public SignatureStandard
|
|||
|
||||
struct ESIGN_Keys
|
||||
{
|
||||
static std::string StaticAlgorithmName() {return "ESIGN";}
|
||||
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ESIGN";}
|
||||
typedef ESIGNFunction PublicKey;
|
||||
typedef InvertibleESIGNFunction PrivateKey;
|
||||
};
|
||||
|
|
|
|||
59
gfpcrypt.h
59
gfpcrypt.h
|
|
@ -37,18 +37,30 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public A
|
|||
public:
|
||||
virtual ~DL_GroupParameters_IntegerBased() {}
|
||||
|
||||
//! \brief Initialize a group parameters over integers
|
||||
//! \param params the group parameters
|
||||
void Initialize(const DL_GroupParameters_IntegerBased ¶ms)
|
||||
{Initialize(params.GetModulus(), params.GetSubgroupOrder(), params.GetSubgroupGenerator());}
|
||||
//! \brief Create a trapdoor function keypair
|
||||
|
||||
//! \brief Create a group parameters over integers
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param pbits the size of p, in bits
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int pbits)
|
||||
{GenerateRandom(rng, MakeParameters("ModulusSize", (int)pbits));}
|
||||
|
||||
//! \brief Initialize a group parameters over integers
|
||||
//! \param p the modulus
|
||||
//! \param g the generator
|
||||
void Initialize(const Integer &p, const Integer &g)
|
||||
{SetModulusAndSubgroupGenerator(p, g); SetSubgroupOrder(ComputeGroupOrder(p)/2);}
|
||||
|
||||
//! \brief Initialize a group parameters over integers
|
||||
//! \param p the modulus
|
||||
//! \param q the subgroup order
|
||||
//! \param g the generator
|
||||
void Initialize(const Integer &p, const Integer &q, const Integer &g)
|
||||
{SetModulusAndSubgroupGenerator(p, g); SetSubgroupOrder(q);}
|
||||
|
||||
|
|
@ -254,10 +266,24 @@ class DL_PublicKey_GFP : public DL_PublicKeyImpl<GP>
|
|||
public:
|
||||
virtual ~DL_PublicKey_GFP() {}
|
||||
|
||||
//! \brief Initialize a public key over GF(p)
|
||||
//! \param params the group parameters
|
||||
//! \param y the public element
|
||||
void Initialize(const DL_GroupParameters_IntegerBased ¶ms, const Integer &y)
|
||||
{this->AccessGroupParameters().Initialize(params); this->SetPublicElement(y);}
|
||||
|
||||
//! \brief Initialize a public key over GF(p)
|
||||
//! \param p the modulus
|
||||
//! \param g the generator
|
||||
//! \param y the public element
|
||||
void Initialize(const Integer &p, const Integer &g, const Integer &y)
|
||||
{this->AccessGroupParameters().Initialize(p, g); this->SetPublicElement(y);}
|
||||
|
||||
//! \brief Initialize a public key over GF(p)
|
||||
//! \param p the modulus
|
||||
//! \param q the subgroup order
|
||||
//! \param g the generator
|
||||
//! \param y the public element
|
||||
void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &y)
|
||||
{this->AccessGroupParameters().Initialize(p, q, g); this->SetPublicElement(y);}
|
||||
|
||||
|
|
@ -280,7 +306,7 @@ public:
|
|||
//! \brief Create a private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param modulusBits the size of the modulus, in bits
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
|
||||
|
|
@ -288,9 +314,9 @@ public:
|
|||
|
||||
//! \brief Create a private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param p TODO
|
||||
//! \param g TODO
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \param p the modulus
|
||||
//! \param g the generator
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &g)
|
||||
|
|
@ -298,20 +324,33 @@ public:
|
|||
|
||||
//! \brief Create a private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param p TODO
|
||||
//! \param q TODO
|
||||
//! \param g TODO
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \param p the modulus
|
||||
//! \param q the subgroup order
|
||||
//! \param g the generator
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &q, const Integer &g)
|
||||
{this->GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupOrder", q)("SubgroupGenerator", g));}
|
||||
|
||||
//! \brief Initialize a private key over GF(p)
|
||||
//! \param params the group parameters
|
||||
//! \param x the private exponent
|
||||
void Initialize(const DL_GroupParameters_IntegerBased ¶ms, const Integer &x)
|
||||
{this->AccessGroupParameters().Initialize(params); this->SetPrivateExponent(x);}
|
||||
|
||||
//! \brief Initialize a private key over GF(p)
|
||||
//! \param p the modulus
|
||||
//! \param g the generator
|
||||
//! \param x the private exponent
|
||||
void Initialize(const Integer &p, const Integer &g, const Integer &x)
|
||||
{this->AccessGroupParameters().Initialize(p, g); this->SetPrivateExponent(x);}
|
||||
|
||||
//! \brief Initialize a private key over GF(p)
|
||||
//! \param p the modulus
|
||||
//! \param q the subgroup order
|
||||
//! \param g the generator
|
||||
//! \param x the private exponent
|
||||
void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &x)
|
||||
{this->AccessGroupParameters().Initialize(p, q, g); this->SetPrivateExponent(x);}
|
||||
};
|
||||
|
|
|
|||
44
luc.h
44
luc.h
|
|
@ -40,6 +40,9 @@ class LUCFunction : public TrapdoorFunction, public PublicKey
|
|||
public:
|
||||
virtual ~LUCFunction() {}
|
||||
|
||||
//! \brief Initialize a LUC public key with {n,e}
|
||||
//! \param n the modulus
|
||||
//! \param e the public exponent
|
||||
void Initialize(const Integer &n, const Integer &e)
|
||||
{m_n = n; m_e = e;}
|
||||
|
||||
|
|
@ -85,6 +88,14 @@ public:
|
|||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17);
|
||||
|
||||
//! \brief Initialize a LUC private key with {n,e,p,q,dp,dq,u}
|
||||
//! \param n modulus
|
||||
//! \param e public exponent
|
||||
//! \param p first prime factor
|
||||
//! \param q second prime factor
|
||||
//! \param u q<sup>-1</sup> mod p
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q, const Integer &u)
|
||||
{m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;}
|
||||
|
||||
|
|
@ -120,6 +131,7 @@ struct LUC
|
|||
};
|
||||
|
||||
//! \brief LUC cryptosystem
|
||||
//! \tparam STANDARD signature standard
|
||||
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
|
||||
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
|
||||
//! defined later in this .h file may be of more practical interest.
|
||||
|
|
@ -129,6 +141,8 @@ struct LUCES : public TF_ES<LUC, STANDARD>
|
|||
};
|
||||
|
||||
//! \brief LUC signature scheme with appendix
|
||||
//! \tparam STANDARD signature standard
|
||||
//! \tparam H hash transformation
|
||||
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
|
||||
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
|
||||
//! defined later in this .h file may be of more practical interest.
|
||||
|
|
@ -194,7 +208,8 @@ private:
|
|||
Integer m_g;
|
||||
};
|
||||
|
||||
//! _
|
||||
//! \class DL_GroupParameters_LUC
|
||||
//! \brief LUC GroupParameters specialization
|
||||
class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl<DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC>
|
||||
{
|
||||
public:
|
||||
|
|
@ -224,7 +239,8 @@ private:
|
|||
int GetFieldType() const {return 2;}
|
||||
};
|
||||
|
||||
//! _
|
||||
//! \class DL_GroupParameters_LUC_DefaultSafePrime
|
||||
//! \brief GF(p) group parameters that default to safe primes
|
||||
class DL_GroupParameters_LUC_DefaultSafePrime : public DL_GroupParameters_LUC
|
||||
{
|
||||
public:
|
||||
|
|
@ -234,7 +250,8 @@ protected:
|
|||
unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;}
|
||||
};
|
||||
|
||||
//! _
|
||||
//! \class DL_Algorithm_LUC_HMP
|
||||
//! \brief LUC HMP signature algorithm
|
||||
class DL_Algorithm_LUC_HMP : public DL_ElgamalLikeSignatureAlgorithm<Integer>
|
||||
{
|
||||
public:
|
||||
|
|
@ -249,7 +266,7 @@ public:
|
|||
{return params.GetGroupOrder().ByteCount();}
|
||||
};
|
||||
|
||||
//! _
|
||||
//! \brief LUC signature keys
|
||||
struct DL_SignatureKeys_LUC
|
||||
{
|
||||
typedef DL_GroupParameters_LUC GroupParameters;
|
||||
|
|
@ -258,6 +275,7 @@ struct DL_SignatureKeys_LUC
|
|||
};
|
||||
|
||||
//! \brief LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster, Markus Michels, Holger Petersen
|
||||
//! \tparam H hash transformation
|
||||
//! \details This class is here for historical and pedagogical interest. It has no practical advantages over other
|
||||
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
|
||||
//! defined later in this .h file may be of more practical interest.
|
||||
|
|
@ -266,7 +284,7 @@ struct LUC_HMP : public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_Sig
|
|||
{
|
||||
};
|
||||
|
||||
//! _
|
||||
//! \brief LUC encryption keys
|
||||
struct DL_CryptoKeys_LUC
|
||||
{
|
||||
typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters;
|
||||
|
|
@ -274,17 +292,23 @@ struct DL_CryptoKeys_LUC
|
|||
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
|
||||
};
|
||||
|
||||
//! LUC-IES
|
||||
template <class COFACTOR_OPTION = NoCofactorMultiplication, bool DHAES_MODE = true>
|
||||
//! \class LUC-IES
|
||||
//! \brief LUC Integrated Encryption Scheme
|
||||
//! \tparam COFACTOR_OPTION \ref CofactorMultiplicationOption "cofactor multiplication option"
|
||||
//! \tparam HASH HashTransformation derived class used for key drivation and MAC computation
|
||||
//! \tparam DHAES_MODE flag indicating if the MAC includes additional context parameters such as <em>u·V</em>, <em>v·U</em> and label
|
||||
//! \tparam LABEL_OCTETS flag indicating if the label size is specified in octets or bits
|
||||
//! \since Crypto++ 4.0, Crypto++ 5.7 for Bouncy Castle and Botan compatibility
|
||||
template <class HASH = SHA1, class COFACTOR_OPTION = NoCofactorMultiplication, bool DHAES_MODE = true, bool LABEL_OCTETS = false>
|
||||
struct LUC_IES
|
||||
: public DL_ES<
|
||||
DL_CryptoKeys_LUC,
|
||||
DL_KeyAgreementAlgorithm_DH<Integer, COFACTOR_OPTION>,
|
||||
DL_KeyDerivationAlgorithm_P1363<Integer, DHAES_MODE, P1363_KDF2<SHA1> >,
|
||||
DL_EncryptionAlgorithm_Xor<HMAC<SHA1>, DHAES_MODE>,
|
||||
DL_KeyDerivationAlgorithm_P1363<Integer, DHAES_MODE, P1363_KDF2<HASH> >,
|
||||
DL_EncryptionAlgorithm_Xor<HMAC<HASH>, DHAES_MODE, LABEL_OCTETS>,
|
||||
LUC_IES<> >
|
||||
{
|
||||
static std::string StaticAlgorithmName() {return "LUC-IES";} // non-standard name
|
||||
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "LUC-IES";} // non-standard name
|
||||
};
|
||||
|
||||
// ********************************************************
|
||||
|
|
|
|||
19
rabin.h
19
rabin.h
|
|
@ -21,6 +21,11 @@ class RabinFunction : public TrapdoorFunction, public PublicKey
|
|||
typedef RabinFunction ThisClass;
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Initialize a Rabin public key
|
||||
//! \param n the modulus
|
||||
//! \param r element r
|
||||
//! \param s element s
|
||||
void Initialize(const Integer &n, const Integer &r, const Integer &s)
|
||||
{m_n = n; m_r = r; m_s = s;}
|
||||
|
||||
|
|
@ -55,14 +60,22 @@ class InvertibleRabinFunction : public RabinFunction, public TrapdoorFunctionInv
|
|||
typedef InvertibleRabinFunction ThisClass;
|
||||
|
||||
public:
|
||||
void Initialize(const Integer &n, const Integer &r, const Integer &s,
|
||||
const Integer &p, const Integer &q, const Integer &u)
|
||||
|
||||
//! \brief Initialize a Rabin private key
|
||||
//! \param n modulus
|
||||
//! \param r element r
|
||||
//! \param s element s
|
||||
//! \param p first prime factor
|
||||
//! \param q second prime factor
|
||||
//! \param u q<sup>-1</sup> mod p
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const Integer &n, const Integer &r, const Integer &s, const Integer &p, const Integer &q, const Integer &u)
|
||||
{m_n = n; m_r = r; m_s = s; m_p = p; m_q = q; m_u = u;}
|
||||
|
||||
//! \brief Create a Rabin private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param keybits the size of the key, in bits
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int keybits)
|
||||
|
|
|
|||
12
rsa.h
12
rsa.h
|
|
@ -26,7 +26,7 @@ class CRYPTOPP_DLL RSAFunction : public TrapdoorFunction, public X509PublicKey
|
|||
typedef RSAFunction ThisClass;
|
||||
|
||||
public:
|
||||
//! \brief Initialize a RSA public key with {n,e}
|
||||
//! \brief Initialize a RSA public key
|
||||
//! \param n the modulus
|
||||
//! \param e the public exponent
|
||||
void Initialize(const Integer &n, const Integer &e)
|
||||
|
|
@ -71,12 +71,12 @@ public:
|
|||
//! \param modulusBits the size of the modulus, in bits
|
||||
//! \param e the desired public exponent
|
||||
//! \details Initialize() creates a new keypair using a public exponent of 17.
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &e = 17);
|
||||
|
||||
//! \brief Initialize a RSA private key with {n,e,d,p,q,dp,dq,u}
|
||||
//! \brief Initialize a RSA private key
|
||||
//! \param n modulus
|
||||
//! \param e public exponent
|
||||
//! \param d private exponent
|
||||
|
|
@ -85,14 +85,16 @@ public:
|
|||
//! \param dp d mod p
|
||||
//! \param dq d mod q
|
||||
//! \param u q<sup>-1</sup> mod p
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
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)
|
||||
{m_n = n; m_e = e; m_d = d; m_p = p; m_q = q; m_dp = dp; m_dq = dq; m_u = u;}
|
||||
|
||||
//! \brief Initialize a RSA private key with {n,e,d}
|
||||
//! \brief Initialize a RSA private key
|
||||
//! \param n modulus
|
||||
//! \param e public exponent
|
||||
//! \param d private exponent
|
||||
//! \details Initialize() will factor n using d and populate {p,q,dp,dq,u}.
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
//! Initialize() will factor n using d and populate {p,q,dp,dq,u}.
|
||||
void Initialize(const Integer &n, const Integer &e, const Integer &d);
|
||||
|
||||
// PKCS8PrivateKey
|
||||
|
|
|
|||
12
rw.h
12
rw.h
|
|
@ -25,6 +25,9 @@ class CRYPTOPP_DLL RWFunction : public TrapdoorFunction, public PublicKey
|
|||
typedef RWFunction ThisClass;
|
||||
|
||||
public:
|
||||
|
||||
//! \brief Initialize a Rabin-Williams public key
|
||||
//! \param n the modulus
|
||||
void Initialize(const Integer &n)
|
||||
{m_n = n;}
|
||||
|
||||
|
|
@ -59,14 +62,21 @@ class CRYPTOPP_DLL InvertibleRWFunction : public RWFunction, public TrapdoorFunc
|
|||
typedef InvertibleRWFunction ThisClass;
|
||||
|
||||
public:
|
||||
//! \brief Construct an InvertibleRWFunction
|
||||
InvertibleRWFunction() : m_precompute(false) {}
|
||||
|
||||
//! \brief Initialize a Rabin-Williams private key
|
||||
//! \param n modulus
|
||||
//! \param p first prime factor
|
||||
//! \param q second prime factor
|
||||
//! \param u q<sup>-1</sup> mod p
|
||||
//! \details This Initialize() function overload initializes a private key from existing parameters.
|
||||
void Initialize(const Integer &n, const Integer &p, const Integer &q, const Integer &u);
|
||||
|
||||
//! \brief Create a Rabin-Williams private key
|
||||
//! \param rng a RandomNumberGenerator derived class
|
||||
//! \param modulusBits the size of the modulus, in bits
|
||||
//! \details This function overload of Initialize() creates a new keypair because it
|
||||
//! \details This function overload of Initialize() creates a new private key because it
|
||||
//! takes a RandomNumberGenerator() as a parameter. If you have an existing keypair,
|
||||
//! then use one of the other Initialize() overloads.
|
||||
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
|
||||
|
|
|
|||
Loading…
Reference in New Issue