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";}
162template <
class H,
class STANDARD = P1363_EMSA5>
Classes and functions for working with ANS.1 objects.
Encode and decode ASN.1 objects with additional information.
virtual void BEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
ESIGN trapdoor function using the public key.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
void Initialize(const Integer &n, const Integer &e)
Initialize a ESIGN public key with {n,e}.
Integer ImageBound() const
Returns the maximum size of a representation after the trapdoor function is applied.
void GenerateRandomWithKeySize(RandomNumberGenerator &rng, unsigned int keySize)
Generate a random key or crypto parameters.
Multiple precision integer with arithmetic operations.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
ESIGN trapdoor function using the private key.
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
Applies the inverse of the trapdoor function, using random data if required.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
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 Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
Create a ESIGN private key.
void Save(BufferedTransformation &bt) const
Saves a key to a BufferedTransformation.
void Load(BufferedTransformation &bt)
Loads a key from a BufferedTransformation.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
Interface for retrieving values given their names.
Interface for message encoding method for public key signature schemes.
Interface for private keys.
Interface for public keys.
Interface for random number generators.
Applies the inverse of the trapdoor function, using random data if required.
size_type size() const
Provides the count of elements in the SecBlock.
Trapdoor Function (TF) Signature Scheme.
Applies the trapdoor function.
unsigned char byte
8-bit unsigned datatype
Abstract base classes that provide a uniform interface to this library.
Multiple precision integer with arithmetic operations.
Utility functions for the Crypto++ library.
T1 SaturatingSubtract(const T1 &a, const T2 &b)
Performs a saturating subtract clamped at 0.
T Crop(T value, size_t bits)
Truncates the value to the specified number of bits.
size_t BitsToBytes(size_t bitCount)
Returns the number of 8-bit bytes or octets required for the specified number of bits.
Crypto++ library namespace.
This file contains helper classes/functions for implementing public key algorithms.
ESIGN signature scheme, IEEE P1363a.
EMSA5 padding method, for use with ESIGN.
Base class for public key signature standard classes.