7 #if CRYPTOPP_MSC_VERSION 8 # pragma warning(disable: 4589) 21 #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 22 void ESIGN_TestInstantiations()
56 return STDMIN(a_exp_b_mod_c(x, m_e, m_n) >> (2*GetK()+2),
MaxImage());
61 CRYPTOPP_UNUSED(rng), CRYPTOPP_UNUSED(level);
65 pass = pass && m_e >= 8 && m_e < m_n;
72 return GetValueHelper(
this, name, valueType, pValue).Assignable()
73 CRYPTOPP_GET_FUNCTION_ENTRY(
Modulus)
80 AssignFromHelper(
this, source)
81 CRYPTOPP_SET_FUNCTION_ENTRY(
Modulus)
90 int modulusSize = 1023*2;
94 throw InvalidArgument(
"InvertibleESIGNFunction: specified modulus size is too small");
96 if (modulusSize % 3 != 0)
97 throw InvalidArgument(
"InvertibleESIGNFunction: modulus size must be divisible by 3");
102 throw InvalidArgument(
"InvertibleESIGNFunction: public exponents less than 8 may not be secure");
112 if (param.
GetValue(
"Seed", seedParam))
115 memcpy(seed + 4, seedParam.
begin(), seedParam.
size());
128 m_n = m_p * m_p * m_q;
136 m_n.BERDecode(privateKey);
137 m_e.BERDecode(privateKey);
146 m_n.DEREncode(privateKey);
147 m_e.DEREncode(privateKey);
164 z = x << (2*GetK()+2);
165 re = a_exp_b_mod_c(r, m_e, m_n);
174 while ((w1 >> (2*GetK()+1)).IsPositive());
182 cout <<
"f = " << x << endl;
183 cout <<
"r = " << r << endl;
184 cout <<
"z = " << z << endl;
185 cout <<
"a = " << a << endl;
186 cout <<
"w0 = " << w0 << endl;
187 cout <<
"w1 = " << w1 << endl;
188 cout <<
"t = " << t << endl;
189 cout <<
"s = " << s << endl;
206 pass = pass && m_p * m_p * m_q == m_n;
219 return GetValueHelper<ESIGNFunction>(
this, name, valueType, pValue).Assignable()
220 CRYPTOPP_GET_FUNCTION_ENTRY(
Prime1)
221 CRYPTOPP_GET_FUNCTION_ENTRY(
Prime2)
227 AssignFromHelper<ESIGNFunction>(
this, source)
228 CRYPTOPP_SET_FUNCTION_ENTRY(
Prime1)
229 CRYPTOPP_SET_FUNCTION_ENTRY(
Prime2)
Used to pass byte array input as part of a NameValuePairs object.
An invalid argument was detected.
bool NotZero() const
Determines if the Integer is non-0.
Classes for working with NameValuePairs.
const Integer & Divide(const Integer &a, const Integer &b) const
Divides elements in the ring.
a number which is probabilistically prime
static void Divide(Integer &r, Integer &q, const Integer &a, const Integer &d)
Extended Division.
static const Integer & One()
Integer representing 1.
const char * Prime2()
Integer.
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
size_t size() const
Length of the memory block.
PK_FinalTemplate< TF_VerifierImpl< SchemeOptions > > Verifier
implements PK_Verifier interface
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
void resize(size_type newSize)
Change size and preserve contents.
void MessageEnd()
Signals the end of messages to the object.
void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, const byte *xorBlock=NULL)
Access a block of memory.
unsigned int word32
32-bit unsigned datatype
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
Applies the inverse of the trapdoor function, using random data if required.
Library configuration file.
Ring of congruence classes modulo n.
Interface for random number generators.
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
Combines two sets of NameValuePairs.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms=g_nullNameValuePairs)
Generate a random number.
Classes providing ESIGN signature schemes as defined in IEEE P1363a.
CRYPTOPP_DLL bool VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level=1)
Verifies a number is probably prime.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
const char * Prime1()
Integer.
void DoQuickSanityCheck() const
Perform a quick sanity check.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
CRYPTOPP_DLL RandomNumberGenerator & NullRNG()
Random Number Generator that does not produce random numbers.
const byte * begin() const
Pointer to the first byte in the memory block.
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
const char * PublicExponent()
Integer.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
virtual Integer MaxImage() const
Returns the maximum size of a message after the trapdoor function is applied bound to a public key...
Multiple precision integer with arithmetic operations.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
const T & STDMIN(const T &a, const T &b)
Replacement function for std::min.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
Classes and functions for working with ANS.1 objects.
Classes for SHA-1 and SHA-2 family of message digests.
CRYPTOPP_DLL bool GetIntValue(const char *name, int &value) const
Get a named value with type int.
unsigned int BitCount() const
Determines the number of bits required to represent the Integer.
void MessageEnd()
Signals the end of messages to the object.
Classes and functions for number theoretic operations.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
An object that implements NameValuePairs.
const char * Modulus()
Integer.
Multiple precision integer with arithmetic operations.
static const Integer & Zero()
Integer representing 0.
void BERDecode(const byte *input, size_t inputLen)
Decode from BER format.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
Class file for performing modular arithmetic.
Crypto++ library namespace.
bool GetValue(const char *name, T &value) const
Get a named value.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
bool IsOdd() const
Determines if the Integer is odd parity.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Interface for retrieving values given their names.
Template implementing constructors for public key algorithm classes.