7 #ifndef CRYPTOPP_ESIGN_H 8 #define CRYPTOPP_ESIGN_H 38 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
47 const Integer & GetModulus()
const {
return m_n;}
48 const Integer & GetPublicExponent()
const {
return m_e;}
50 void SetModulus(
const Integer &n) {m_n = n;}
51 void SetPublicExponent(
const Integer &e) {m_e = e;}
75 {m_n = n; m_e = e; m_p = p; m_q = q;}
101 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
106 const Integer& GetPrime1()
const {
return m_p;}
107 const Integer& GetPrime2()
const {
return m_q;}
109 void SetPrime1(
const Integer &p) {m_p = p;}
110 void SetPrime2(
const Integer &q) {m_q = q;}
123 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "EMSA5";}
126 const byte *recoverableMessage,
size_t recoverableMessageLength,
128 byte *representative,
size_t representativeBitLength)
const 130 CRYPTOPP_UNUSED(rng), CRYPTOPP_UNUSED(recoverableMessage), CRYPTOPP_UNUSED(recoverableMessageLength);
131 CRYPTOPP_UNUSED(messageEmpty), CRYPTOPP_UNUSED(hashIdentifier);
134 size_t representativeByteLength =
BitsToBytes(representativeBitLength);
136 mgf.GenerateAndMask(hash, representative, representativeByteLength, digest, digest.size(),
false);
137 if (representativeBitLength % 8 != 0)
138 representative[0] = (byte)
Crop(representative[0], representativeBitLength % 8);
153 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "ESIGN";}
162 template <
class H,
class STANDARD = P1363_EMSA5>
Integer ImageBound() const
Returns the maximum size of a message after the trapdoor function is applied.
Utility functions for the Crypto++ library.
size_t BitsToBytes(size_t bitCount)
Returns the number of 8-bit bytes or octets required for the specified number of bits.
This file contains helper classes/functions for implementing public key algorithms.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
ESIGN signature scheme, IEEE P1363a.
Abstract base classes that provide a uniform interface to this library.
void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q)
Initialize a ESIGN private key with {n,e,p,q}.
void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
Applies the inverse of the trapdoor function, using random data if required.
void Initialize(const Integer &n, const Integer &e)
Initialize a ESIGN public key with {n,e}.
Interface for random number generators.
Interface for private keys.
Base class for public key signature standard classes.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Interface for message encoding method for public key signature schemes.
T Crop(T value, size_t bits)
Truncates the value to the specified number of bits.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
ESIGN trapdoor function using the private key.
Multiple precision integer with arithmetic operations.
T1 SaturatingSubtract(const T1 &a, const T2 &b)
Performs a saturating subtract clamped at 0.
Applies the trapdoor function.
EMSA5 padding method, for use with ESIGN.
Classes and functions for working with ANS.1 objects.
ESIGN trapdoor function using the public key.
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize)
Generate a random key or crypto parameters.
Multiple precision integer with arithmetic operations.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
Create a ESIGN private key.
void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
Interface for public keys.
Crypto++ library namespace.
Applies the inverse of the trapdoor function, using random data if required.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
virtual void BEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
Encode and decode ASN.1 objects with additional information.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Interface for retrieving values given their names.
Trapdoor Function (TF) Signature Scheme.