1 #ifndef CRYPTOPP_ESIGN_H 2 #define CRYPTOPP_ESIGN_H 32 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
41 const Integer & GetModulus()
const {
return m_n;}
42 const Integer & GetPublicExponent()
const {
return m_e;}
44 void SetModulus(
const Integer &n) {m_n = n;}
45 void SetPublicExponent(
const Integer &e) {m_e = e;}
61 {m_n = n; m_e = e; m_p = p; m_q = q;}
73 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
78 const Integer& GetPrime1()
const {
return m_p;}
79 const Integer& GetPrime2()
const {
return m_q;}
81 void SetPrime1(
const Integer &p) {m_p = p;}
82 void SetPrime2(
const Integer &q) {m_q = q;}
93 CRYPTOPP_CONSTEXPR
static const char *StaticAlgorithmName() {
return "EMSA5";}
96 const byte *recoverableMessage,
size_t recoverableMessageLength,
98 byte *representative,
size_t representativeBitLength)
const 100 CRYPTOPP_UNUSED(rng), CRYPTOPP_UNUSED(recoverableMessage), CRYPTOPP_UNUSED(recoverableMessageLength);
101 CRYPTOPP_UNUSED(messageEmpty), CRYPTOPP_UNUSED(hashIdentifier);
104 size_t representativeByteLength =
BitsToBytes(representativeBitLength);
106 mgf.GenerateAndMask(hash, representative, representativeByteLength, digest, digest.size(),
false);
107 if (representativeBitLength % 8 != 0)
108 representative[0] = (byte)
Crop(representative[0], representativeBitLength % 8);
120 static std::string StaticAlgorithmName() {
return "ESIGN";}
126 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, as defined in IEEE P1363a.
Abstract base classes that provide a uniform interface to this library.
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
Applies the inverse of the trapdoor function, using random data if required.
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.
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, for use with ESIGN.
Classes and functions for working with ANS.1 objects.
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize)
Generate a random key or crypto parameters.
Multiple precision integer with arithmetic operations.
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)
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.