1 #ifndef CRYPTOPP_ESIGN_H
2 #define CRYPTOPP_ESIGN_H
13 NAMESPACE_BEGIN(CryptoPP)
30 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
35 Integer PreimageBound()
const {
return m_n;}
39 const Integer & GetModulus()
const {
return m_n;}
40 const Integer & GetPublicExponent()
const {
return m_e;}
42 void SetModulus(
const Integer &n) {m_n = n;}
43 void SetPublicExponent(
const Integer &e) {m_e = e;}
46 unsigned int GetK()
const {
return m_n.
BitCount()/3-1;}
58 {m_n = n; m_e = e; m_p = p; m_q = q;}
70 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
75 const Integer& GetPrime1()
const {
return m_p;}
76 const Integer& GetPrime2()
const {
return m_q;}
78 void SetPrime1(
const Integer &p) {m_p = p;}
79 void SetPrime2(
const Integer &q) {m_q = q;}
90 static const char *StaticAlgorithmName() {
return "EMSA5";}
93 const byte *recoverableMessage,
size_t recoverableMessageLength,
95 byte *representative,
size_t representativeBitLength)
const
99 size_t representativeByteLength = BitsToBytes(representativeBitLength);
101 mgf.GenerateAndMask(hash, representative, representativeByteLength, digest, digest.size(),
false);
102 if (representativeBitLength % 8 != 0)
103 representative[0] = (byte)Crop(representative[0], representativeBitLength % 8);
115 static std::string StaticAlgorithmName() {
return "ESIGN";}
121 template <
class H,
class STANDARD = P1363_EMSA5>
This file contains helper classes/functions for implementing public key algorithms.
ESIGN, as defined in IEEE P1363a.
void DEREncode(BufferedTransformation &bt) const
encode this object into a BufferedTransformation, using DER (Distinguished Encoding Rules) ...
interface for random number generators
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
check this object for errors
interface for private keys
Base class for public key signature standard classes. These classes are used to select from variants ...
unsigned int BitCount() const
number of significant bits = floor(log2(abs(*this))) + 1
void BERDecode(BufferedTransformation &bt)
decode this object from a BufferedTransformation, using BER (Basic Encoding Rules) ...
void AssignFrom(const NameValuePairs &source)
assign values from source to this object
multiple precision integer and basic arithmetics
EMSA5, for use with ESIGN.
static Integer Power2(size_t e)
return the integer 2**e
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
to be implemented by derived classes, users should use one of the above functions instead ...
Trapdoor Function Based Signature Scheme.
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize)
calls the above function with a NameValuePairs object that just specifies "KeySize" ...
interface for public keys
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
interface for retrieving values given their names