19#if CRYPTOPP_MSC_VERSION
21# pragma warning(disable: 4127 4189)
31NAMESPACE_BEGIN(CryptoPP)
59 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
63 const Integer & GetModulus()
const {
return m_n;}
64 const Integer & GetPublicExponent()
const {
return m_e;}
66 void SetModulus(
const Integer &n) {m_n = n;}
67 void SetPublicExponent(
const Integer &e) {m_e = e;}
103 {m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;}
111 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const;
117 const Integer& GetPrime1()
const {
return m_p;}
118 const Integer& GetPrime2()
const {
return m_q;}
119 const Integer& GetMultiplicativeInverseOfPrime2ModPrime1()
const {
return m_u;}
121 void SetPrime1(
const Integer &p) {m_p = p;}
122 void SetPrime2(
const Integer &q) {m_q = q;}
123 void SetMultiplicativeInverseOfPrime2ModPrime1(
const Integer &u) {m_u = u;}
133 static std::string StaticAlgorithmName() {
return "LUC";}
144template <
class STANDARD>
156template <
class STANDARD,
class H>
183 void SetModulus(
const Integer &v) {m_p = v;}
184 const Integer & GetModulus()
const {
return m_p;}
200 {CRYPTOPP_UNUSED(group); m_g = base;}
202 {CRYPTOPP_UNUSED(group);
return m_g;}
204 {CRYPTOPP_UNUSED(group); CRYPTOPP_UNUSED(maxExpBits); CRYPTOPP_UNUSED(storage);}
206 {CRYPTOPP_UNUSED(group); CRYPTOPP_UNUSED(storedPrecomputation);}
208 {CRYPTOPP_UNUSED(group); CRYPTOPP_UNUSED(storedPrecomputation);}
212 CRYPTOPP_UNUSED(group); CRYPTOPP_UNUSED(exponent); CRYPTOPP_UNUSED(pc2); CRYPTOPP_UNUSED(exponent2);
214 throw NotImplemented(
"DL_BasePrecomputation_LUC: CascadeExponentiate not implemented");
230 void SimultaneousExponentiate(Element *results,
const Element &base,
const Integer *exponents,
unsigned int exponentsCount)
const;
231 Element MultiplyElements(
const Element &a,
const Element &b)
const
233 CRYPTOPP_UNUSED(a); CRYPTOPP_UNUSED(b);
234 throw NotImplemented(
"LUC_GroupParameters: MultiplyElements can not be implemented");
236 Element CascadeExponentiate(
const Element &element1,
const Integer &exponent1,
const Element &element2,
const Integer &exponent2)
const
238 CRYPTOPP_UNUSED(element1); CRYPTOPP_UNUSED(exponent1); CRYPTOPP_UNUSED(element2); CRYPTOPP_UNUSED(exponent2);
239 throw NotImplemented(
"LUC_GroupParameters: MultiplyElements can not be implemented");
243 bool GetVoidValue(
const char *name,
const std::type_info &valueType,
void *pValue)
const
245 return GetValueHelper<DL_GroupParameters_IntegerBased>(
this, name, valueType, pValue).Assignable();
249 int GetFieldType()
const {
return 2;}
260 unsigned int GetDefaultSubgroupOrderSize(
unsigned int modulusSize)
const {
return modulusSize-1;}
268 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "LUC-HMP";}
295struct LUC_HMP :
public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_SignatureMessageEncodingMethod_DSA, H>
315template <
class HASH = SHA1,
class COFACTOR_OPTION = NoCofactorMultiplication,
bool DHAES_MODE = true,
bool LABEL_OCTETS = false>
319 DL_KeyAgreementAlgorithm_DH<Integer, COFACTOR_OPTION>,
320 DL_KeyDerivationAlgorithm_P1363<Integer, DHAES_MODE, P1363_KDF2<HASH> >,
321 DL_EncryptionAlgorithm_Xor<HMAC<HASH>, DHAES_MODE, LABEL_OCTETS>,
324 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return "LUC-IES";}
334#if CRYPTOPP_MSC_VERSION
Classes for performing mathematics over different fields.
LUC HMP signature algorithm.
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.
size_t RLen(const DL_GroupParameters< Integer > ¶ms) const
Retrieve R length.
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.
void Load(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
Integer Exponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent) const
Exponentiates an element.
void Save(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
void Precompute(const DL_GroupPrecomputation< Element > &group, unsigned int maxExpBits, unsigned int storage)
Perform precomputation.
void SetBase(const DL_GroupPrecomputation< Element > &group, const Integer &base)
Set the base element.
Integer CascadeExponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent, const DL_FixedBasePrecomputation< Integer > &pc2, const Integer &exponent2) const
Exponentiates an element.
bool IsInitialized() const
Determines whether this object is initialized.
const Integer & GetBase(const DL_GroupPrecomputation< Element > &group) const
Get the base element.
Discrete Log (DL) encryption scheme.
Interface for Elgamal-like signature algorithms.
DL_FixedBasePrecomputation interface.
Integer-based GroupParameters default implementation.
GF(p) group parameters that default to safe primes.
LUC GroupParameters specialization.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
Interface for Discrete Log (DL) group parameters.
virtual Integer GetGroupOrder() const
Retrieves the order of the group.
LUC GroupParameters precomputation.
const AbstractGroup< Element > & GetGroup() const
Retrieves AbstractGroup interface.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
DL_GroupPrecomputation interface.
Discrete Log (DL) private key in GF(p) groups.
Discrete Log (DL) public key in GF(p) groups.
Interface for Discrete Log (DL) public keys.
Discrete Log (DL) signature scheme.
Multiple precision integer with arithmetic operations.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
bool NotZero() const
Determines if the Integer is non-0.
unsigned int ByteCount() const
Determines the number of bytes required to represent the Integer.
static const Integer &CRYPTOPP_API Two()
Integer representing 2.
The LUC inverse function.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void Initialize(const Integer &n, const Integer &e, const Integer &p, const Integer &q, const Integer &u)
Initialize a LUC private key with {n,e,p,q,dp,dq,u}.
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)
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 LUC public key with {n,e}.
Integer ImageBound() const
Returns the maximum size of a representation after the trapdoor function is applied.
Interface for retrieving values given their names.
A method was called which was not implemented.
Template implementing constructors for public key algorithm classes.
Interface for private keys.
Interface for public keys.
Interface for random number generators.
Trapdoor Function (TF) encryption scheme.
Trapdoor Function (TF) Signature Scheme.
Applies the trapdoor function.
Applies the inverse of the trapdoor function.
Abstract base classes that provide a uniform interface to this library.
Classes for Diffie-Hellman key exchange.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
Multiple precision integer with arithmetic operations.
DH_Domain< DL_GroupParameters_LUC_DefaultSafePrime > LUC_DH
LUC-DH.
Classes for optimal asymmetric encryption padding.
Classes for PKCS padding schemes.
Classes and functions for secure memory allocations.
Converts an enumeration to a type suitable for use as a template parameter.
LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster,...
LUC Integrated Encryption Scheme.
LUC signature scheme with appendix.