10 #ifndef CRYPTOPP_LUC_H 11 #define CRYPTOPP_LUC_H 19 #if CRYPTOPP_MSC_VERSION 20 # pragma warning(push) 21 # pragma warning(disable: 4127 4189) 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";}
144 template <
class STANDARD>
156 template <
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";}
295 struct LUC_HMP :
public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_SignatureMessageEncodingMethod_DSA, H>
315 template <
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 335 # pragma warning(pop) void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17)
Create a LUC private key.
bool NotZero() const
Determines if the Integer is non-0.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
Trapdoor Function (TF) encryption scheme.
bool IsInitialized() const
Determines whether this object is initialized.
LUC HMP signature algorithm.
DL_GroupPrecomputation interface.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
void Precompute(const DL_GroupPrecomputation< Element > &group, unsigned int maxExpBits, unsigned int storage)
Perform precomputation.
LUC Integrated Encryption Scheme.
Converts an enumeration to a type suitable for use as a template parameter.
Abstract base classes that provide a uniform interface to this library.
LUC GroupParameters specialization.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
virtual Integer GetGroupOrder() const
Retrieves the order of the group.
Interface for random number generators.
Discrete Log (DL) encryption scheme.
Classes for performing mathematics over different fields.
void Save(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
Interface for private keys.
Interface for Discrete Log (DL) public keys.
GF(p) group parameters that default to safe primes.
Discrete Log (DL) signature scheme.
unsigned int ByteCount() const
Determines the number of bytes required to represent the Integer.
Classes and functions for secure memory allocations.
void SetBase(const DL_GroupPrecomputation< Element > &group, const Integer &base)
Set the base element.
Applies the inverse of the trapdoor function.
LUC signature scheme with appendix.
Classes for PKCS padding schemes.
A method was called which was not implemented.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
Interface for Elgamal-like signature algorithms.
Classes for Diffie-Hellman key exchange.
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.
Multiple precision integer with arithmetic operations.
Integer-based GroupParameters default implementation.
static const Integer & Two()
Integer representing 2.
Applies the trapdoor function.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Classes for optimal asymmetric encryption padding.
The LUC inverse function.
DL_FixedBasePrecomputation interface.
Discrete Log (DL) public key in GF(p) groups.
Integer PreimageBound() const
Returns the maximum size of a message before the trapdoor function is applied.
Integer ImageBound() const
Returns the maximum size of a message after the trapdoor function is applied.
void Load(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
Integer CascadeExponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent, const DL_FixedBasePrecomputation< Integer > &pc2, const Integer &exponent2) const
Exponentiates an element.
LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster...
Discrete Log (DL) private key in GF(p) groups.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
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}.
Multiple precision integer with arithmetic operations.
LUC GroupParameters precomputation.
Interface for public keys.
Crypto++ library namespace.
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.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
DH_Domain< DL_GroupParameters_LUC_DefaultSafePrime > LUC_DH
LUC-DH.
bool IsIdentity(const Integer &element) const
Determines if an element is an identity.
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 Initialize(const Integer &n, const Integer &e)
Initialize a LUC public key with {n,e}.
Interface for retrieving values given their names.
const Integer & GetBase(const DL_GroupPrecomputation< Element > &group) const
Get the base element.
Template implementing constructors for public key algorithm classes.
Trapdoor Function (TF) Signature Scheme.