Crypto++
8.6
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
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;}
198 bool IsInitialized()
const {
return m_g.
NotZero();}
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)
Classes for optimal asymmetric encryption padding.
LUC HMP signature algorithm.
Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const
Calculates the inverse of an element.
Interface for private keys.
Converts an enumeration to a type suitable for use as a template parameter.
A method was called which was not implemented.
LUC GroupParameters specialization.
virtual Integer GetGroupOrder() const
Retrieves the order of the group.
void DEREncode(BufferedTransformation &bt) const
Encode in DER format.
bool NotZero() const
Determines if the Integer is non-0.
size_t RLen(const DL_GroupParameters< Integer > ¶ms) const
Retrieve R length.
Discrete Log (DL) public key in GF(p) groups.
Discrete Log (DL) encryption scheme.
void Save(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
Applies the trapdoor function.
GF(p) group parameters that default to safe primes.
Discrete Log (DL) signature scheme.
The LUC inverse function.
Classes and functions for secure memory allocations.
DL_FixedBasePrecomputation interface.
void SetBase(const DL_GroupPrecomputation< Element > &group, const Integer &base)
Set the base element.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Classes and functions for schemes based on Discrete Logs (DL) over GF(p)
LUC Integrated Encryption Scheme.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
void Precompute(const DL_GroupPrecomputation< Element > &group, unsigned int maxExpBits, unsigned int storage)
Perform precomputation.
LUC GroupParameters precomputation.
Classes for Diffie-Hellman key exchange.
Classes for PKCS padding schemes.
Interface for random number generators.
Discrete Log (DL) private key in GF(p) groups.
unsigned int ByteCount() const
Determines the number of bytes required to represent the Integer.
bool IsIdentity(const Integer &element) const
Determines if an element is an identity.
DL_GroupPrecomputation interface.
DH_Domain< DL_GroupParameters_LUC_DefaultSafePrime > LUC_DH
LUC-DH.
Interface for Elgamal-like signature algorithms.
Interface for public keys.
Applies the inverse of the trapdoor function.
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}.
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 CascadeExponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent, const DL_FixedBasePrecomputation< Integer > &pc2, const Integer &exponent2) const
Exponentiates an element.
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.
LUC signature scheme with appendix.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &eStart=17)
Create a LUC private key.
void Load(const DL_GroupPrecomputation< Element > &group, BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
LUC-HMP, based on "Digital signature schemes based on Lucas functions" by Patrick Horster,...
Classes for performing mathematics over different fields.
Crypto++ library namespace.
void Initialize(const Integer &n, const Integer &e)
Initialize a LUC public key with {n,e}.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
const Integer & GetBase(const DL_GroupPrecomputation< Element > &group) const
Get the base element.
Interface for Discrete Log (DL) public keys.
Trapdoor Function (TF) Signature Scheme.
static const Integer & Two()
Integer representing 2.
Trapdoor Function (TF) encryption scheme.
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-based GroupParameters default implementation.
Template implementing constructors for public key algorithm classes.
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
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.
Interface for retrieving values given their names.
Abstract base classes that provide a uniform interface to this library.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
Multiple precision integer with arithmetic operations.
Multiple precision integer with arithmetic operations.