14#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
15void LUC_TestInstantiations()
27 s = (k + x*(r+e)) % q;
37 return (Vsg*Vsg + Vry*Vry + r*r) % p == (Vsg * Vry * r + 4) % p;
45void DL_GroupParameters_LUC::SimultaneousExponentiate(Element *results,
const Element &base,
const Integer *exponents,
unsigned int exponentsCount)
const
47 for (
unsigned int i=0; i<exponentsCount; i++)
70 return Lucas(m_e, x, m_n);
75 CRYPTOPP_UNUSED(rng), CRYPTOPP_UNUSED(level);
86 return GetValueHelper(
this, name, valueType, pValue).Assignable()
87 CRYPTOPP_GET_FUNCTION_ENTRY(
Modulus)
94 AssignFromHelper(
this, source)
95 CRYPTOPP_SET_FUNCTION_ENTRY(
Modulus)
107 bool IsAcceptable(
const Integer &candidate)
const
116 int modulusSize = 2048;
119 if (modulusSize < 16)
120 throw InvalidArgument(
"InvertibleLUCFunction: specified modulus size is too small");
124 if (m_e < 5 || m_e.IsEven())
125 throw InvalidArgument(
"InvertibleLUCFunction: invalid public exponent");
129 (
"PointerToPrimeSelector", selector.GetSelectorPointer());
162 const byte version[] = {
INTEGER, 1, 0};
163 seq.Put(version,
sizeof(version));
175 CRYPTOPP_UNUSED(rng);
192 pass = pass && m_p * m_q == m_n;
202 pass = pass && m_u * m_q % m_p == 1;
215 return GetValueHelper<LUCFunction>(
this, name, valueType, pValue).Assignable()
216 CRYPTOPP_GET_FUNCTION_ENTRY(
Prime1)
217 CRYPTOPP_GET_FUNCTION_ENTRY(
Prime2)
224 AssignFromHelper<LUCFunction>(
this, source)
225 CRYPTOPP_SET_FUNCTION_ENTRY(
Prime1)
226 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.
void BERDecodeError()
Raises a BERDecodeErr.
An object that implements NameValuePairs.
void DoQuickSanityCheck() const
Perform a quick sanity check.
bool Verify(const DL_GroupParameters< Integer > ¶ms, const DL_PublicKey< Integer > &publicKey, const Integer &e, const Integer &r, const Integer &s) const
Verify a message using a public key.
void Sign(const DL_GroupParameters< Integer > ¶ms, const Integer &x, const Integer &k, const Integer &e, Integer &r, Integer &s) const
Sign a message using a private key.
Integer Exponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent) const
Exponentiates an element.
const Integer & GetModulus() const
Retrieve the modulus for the group.
virtual Integer GetGroupOrder() const
Retrieves the order of the group.
virtual const Integer & GetSubgroupOrder() const =0
Retrieves the subgroup order.
virtual Element ExponentiateBase(const Integer &exponent) const
Exponentiates the base.
LUC GroupParameters precomputation.
DL_GroupPrecomputation interface.
Interface for Discrete Log (DL) public keys.
virtual Element ExponentiatePublicElement(const Integer &exponent) const
Exponentiates this element.
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.
bool IsPositive() const
Determines if the Integer is positive.
void BERDecode(const byte *input, size_t inputLen)
Decode from BER format.
bool IsOdd() const
Determines if the Integer is odd parity.
Integer InverseMod(const Integer &n) const
Calculate multiplicative inverse.
static const Integer & One()
Integer representing 1.
An invalid argument was detected.
The LUC inverse function.
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.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17)
Create a LUC private key.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
Integer ApplyFunction(const Integer &x) const
Applies the trapdoor.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
Interface for retrieving values given their names.
T GetValueWithDefault(const char *name, T defaultValue) 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.
Application callback to signal suitability of a cabdidate prime.
Interface for random number generators.
Multiple precision integer with arithmetic operations.
Classes for the LUC cryptosystem.
Crypto++ library namespace.
const char * MultiplicativeInverseOfPrime2ModPrime1()
Integer.
const char * Prime2()
Integer.
const char * Modulus()
Integer.
const char * PublicExponent()
Integer.
const char * Prime1()
Integer.
Classes and functions for number theoretic operations.
bool RelativelyPrime(const Integer &a, const Integer &b)
Determine relative primality.
CRYPTOPP_DLL Integer Lucas(const Integer &e, const Integer &p, const Integer &n)
Calculate the Lucas value.
CRYPTOPP_DLL Integer InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u)
Calculate the inverse Lucas value.
CRYPTOPP_DLL bool VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level=1)
Verifies a number is probably prime.
Classes for PKCS padding schemes.
Classes for SHA-1 and SHA-2 family of message digests.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.