7#if CRYPTOPP_MSC_VERSION
8# pragma warning(disable: 4589)
19NAMESPACE_BEGIN(CryptoPP)
21#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
22void 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);
64 CRYPTOPP_ASSERT(pass);
65 pass = pass && m_e >= 8 && m_e < m_n;
66 CRYPTOPP_ASSERT(pass);
72 return GetValueHelper(
this, name, valueType, pValue).Assignable()
73 CRYPTOPP_GET_FUNCTION_ENTRY(Modulus)
74 CRYPTOPP_GET_FUNCTION_ENTRY(PublicExponent)
80 AssignFromHelper(
this, source)
81 CRYPTOPP_SET_FUNCTION_ENTRY(Modulus)
82 CRYPTOPP_SET_FUNCTION_ENTRY(PublicExponent)
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;
130 CRYPTOPP_ASSERT(m_n.
BitCount() == (
unsigned int)modulusSize);
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());
179 CRYPTOPP_ASSERT(s < m_n);
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;
197 CRYPTOPP_ASSERT(pass);
199 CRYPTOPP_ASSERT(pass);
201 CRYPTOPP_ASSERT(pass);
203 CRYPTOPP_ASSERT(pass);
206 pass = pass && m_p * m_p * m_q == m_n;
207 CRYPTOPP_ASSERT(pass);
211 pass = pass && VerifyPrime(rng, m_p, level-2) && VerifyPrime(rng, m_q, level-2);
212 CRYPTOPP_ASSERT(pass);
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)
Classes for working with NameValuePairs.
AlgorithmParameters MakeParameters(const char *name, const T &value, bool throwIfNotUsed=true)
Create an object that implements NameValuePairs.
Classes and functions for working with ANS.1 objects.
An object that implements NameValuePairs.
void MessageEnd()
Signals the end of messages to the object.
Combines two sets of NameValuePairs.
Used to pass byte array input as part of a NameValuePairs object.
const byte * begin() const
Pointer to the first byte in the memory block.
size_t size() const
Length of the memory block.
void DoQuickSanityCheck() const
Perform a quick sanity check.
void MessageEnd()
Signals the end of messages to the object.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
void DEREncode(BufferedTransformation &bt) const
Encode this object into a BufferedTransformation.
void BERDecode(BufferedTransformation &bt)
Decode this object from a BufferedTransformation.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
Multiple precision integer with arithmetic operations.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms=g_nullNameValuePairs)
Generate a random number.
static const Integer &CRYPTOPP_API Zero()
Integer representing 0.
bool NotZero() const
Determines if the Integer is non-0.
static void CRYPTOPP_API Divide(Integer &r, Integer &q, const Integer &a, const Integer &d)
Extended Division.
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
void BERDecode(const byte *input, size_t inputLen)
Decode from BER format.
unsigned int BitCount() const
Determines the number of bits required to represent the Integer.
static const Integer &CRYPTOPP_API One()
Integer representing 1.
@ PRIME
a number which is probabilistically prime
static Integer CRYPTOPP_API Power2(size_t e)
Exponentiates to a power of 2.
bool IsOdd() const
Determines if the Integer is odd parity.
An invalid argument was detected.
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 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.
Ring of congruence classes modulo n.
const Integer & Divide(const Integer &a, const Integer &b) const
Divides elements in the ring.
Interface for retrieving values given their names.
T GetValueWithDefault(const char *name, T defaultValue) const
Get a named value.
bool GetValue(const char *name, T &value) const
Get a named value.
CRYPTOPP_DLL bool GetIntValue(const char *name, int &value) const
Get a named value with type int.
Template implementing constructors for public key algorithm classes.
Interface for random number generators.
void resize(size_type newSize)
Change size and preserve contents.
PK_FinalTemplate< TF_VerifierImpl< SchemeOptions > > Verifier
implements PK_Verifier interface
virtual Integer MaxImage() const
Returns the maximum size of a representation after the trapdoor function is applied bound to a public...
Library configuration file.
unsigned int word32
32-bit unsigned datatype
@ BIG_ENDIAN_ORDER
byte order is big-endian
Classes providing ESIGN signature schemes as defined in IEEE P1363a.
Multiple precision integer with arithmetic operations.
void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, const byte *xorBlock=NULLPTR)
Access a block of memory.
const T & STDMIN(const T &a, const T &b)
Replacement function for std::min.
Class file for performing modular arithmetic.
Classes and functions for number theoretic operations.
Classes for SHA-1 and SHA-2 family of message digests.