34 #ifndef CRYPTOPP_PUBKEY_H 35 #define CRYPTOPP_PUBKEY_H 39 #if CRYPTOPP_MSC_VERSION 40 # pragma warning(push) 41 # pragma warning(disable: 4702) 55 #if defined(__SUNPRO_CC) 56 # define MAYBE_RETURN(x) return x 58 # define MAYBE_RETURN(x) CRYPTOPP_UNUSED(x) 81 virtual Integer PreimageBound()
const =0;
85 virtual Integer ImageBound()
const =0;
196 {
return CalculateInverse(rng, x);}
223 virtual size_t MaxUnpaddedLength(
size_t paddedLength)
const =0;
236 template <
class TFI,
class MEI>
245 virtual const TrapdoorFunctionInterface & GetTrapdoorFunctionInterface()
const =0;
248 virtual const MessageEncodingInterface & GetMessageEncodingInterface()
const =0;
256 template <
class BASE>
263 {
return ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;}
265 {
return plaintextLength <= FixedMaxPlaintextLength() ? FixedCiphertextLength() : 0;}
267 virtual size_t FixedMaxPlaintextLength()
const =0;
268 virtual size_t FixedCiphertextLength()
const =0;
275 template <
class INTFACE,
class BASE>
282 size_t FixedMaxPlaintextLength()
const {
return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
329 virtual size_t MaxRecoverableLength(
size_t representativeBitLength,
size_t hashIdentifierLength,
size_t digestLength)
const 341 {
throw NotImplemented(
"PK_MessageEncodingMethod: this signature scheme does not support message recovery");}
343 {
throw NotImplemented(
"PK_MessageEncodingMethod: this signature scheme does not support message recovery");}
351 const byte *recoverableMessage,
size_t recoverableMessageLength,
352 const byte *presignature,
size_t presignatureLength,
357 if (RecoverablePartFirst())
362 const byte *recoverableMessage,
size_t recoverableMessageLength,
364 byte *representative,
size_t representativeBitLength)
const =0;
366 virtual bool VerifyMessageRepresentative(
368 byte *representative,
size_t representativeBitLength)
const =0;
372 byte *representative,
size_t representativeBitLength,
373 byte *recoveredMessage)
const 376 throw NotImplemented(
"PK_MessageEncodingMethod: this signature scheme does not support message recovery");}
380 const byte *presignature,
size_t presignatureLength,
381 const byte *semisignature,
size_t semisignatureLength,
382 byte *recoveredMessage)
const 385 throw NotImplemented(
"PK_MessageEncodingMethod: this signature scheme does not support message recovery");}
407 bool VerifyMessageRepresentative(
409 byte *representative,
size_t representativeBitLength)
const;
419 bool VerifyMessageRepresentative(
421 byte *representative,
size_t representativeBitLength)
const;
432 const byte *recoverableMessage,
size_t recoverableMessageLength,
434 byte *representative,
size_t representativeBitLength)
const;
445 const byte *recoverableMessage,
size_t recoverableMessageLength,
447 byte *representative,
size_t representativeBitLength)
const;
463 AccessHash().Update(input, length);
464 m_empty = m_empty && length == 0;
476 template <
class HASH_ALGORITHM>
484 template <
class INTFACE,
class BASE>
491 {
return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
493 {
return this->GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());}
495 {
CRYPTOPP_UNUSED(signatureLength);
return this->MaxRecoverableLength();}
498 {
return this->GetTrapdoorFunctionInterface().IsRandomized() || this->GetMessageEncodingInterface().IsProbabilistic();}
500 {
return this->GetMessageEncodingInterface().AllowNonrecoverablePart();}
502 {
return this->GetMessageEncodingInterface().RecoverablePartFirst();}
509 virtual size_t GetDigestSize()
const =0;
518 void InputRecoverableMessage(
PK_MessageAccumulator &messageAccumulator,
const byte *recoverableMessage,
size_t recoverableMessageLength)
const;
536 template <
class T1,
class T2,
class T3>
547 template <
class T1,
class T2,
class T3,
class T4>
554 template <
class BASE,
class SCHEME_OPTIONS,
class KEY_CLASS>
569 virtual const KeyClass & GetKey()
const =0;
570 virtual KeyClass & AccessKey() =0;
595 typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2<typename SchemeOptions::HashFunction> L;
601 return H::DIGESTSIZE;
606 template <
class BASE,
class SCHEME_OPTIONS,
class KEY>
615 const KEY &
GetKey()
const {
return *m_pKey;}
623 template <
class BASE,
class SCHEME_OPTIONS,
class KEY_CLASS>
631 const KeyClass &
GetKey()
const {
return m_trapdoorFunction;}
639 template <
class SCHEME_OPTIONS>
645 template <
class SCHEME_OPTIONS>
651 template <
class SCHEME_OPTIONS>
657 template <
class SCHEME_OPTIONS>
678 virtual void GenerateAndMask(
HashTransformation &hash,
byte *output,
size_t outputLength,
const byte *input,
size_t inputLength,
bool mask =
true)
const =0;
718 P1363_MGF1KDF2_Common(h, output, outputLength, input, inputLength, derivationParams, derivationParamsLength,
false, 1);
750 if (!GetBasePrecomputation().IsInitialized())
753 if (m_validationLevel > level)
756 bool pass = ValidateGroup(rng, level);
757 pass = pass && ValidateElement(level, GetSubgroupGenerator(), &GetBasePrecomputation());
759 m_validationLevel = pass ? level+1 : 0;
776 AccessBasePrecomputation().Precompute(GetGroupPrecomputation(), GetSubgroupOrder().BitCount(), precomputationStorage);
781 AccessBasePrecomputation().Load(GetGroupPrecomputation(), storedPrecomputation);
782 m_validationLevel = 0;
787 GetBasePrecomputation().Save(GetGroupPrecomputation(), storedPrecomputation);
793 virtual const Element &
GetSubgroupGenerator()
const {
return GetBasePrecomputation().GetBase(GetGroupPrecomputation());}
798 virtual void SetSubgroupGenerator(
const Element &base) {AccessBasePrecomputation().SetBase(GetGroupPrecomputation(), base);}
805 return GetBasePrecomputation().Exponentiate(GetGroupPrecomputation(), exponent);
816 SimultaneousExponentiate(&result, base, &exponent, 1);
834 virtual const Integer & GetSubgroupOrder()
const =0;
838 virtual Integer GetMaxExponent()
const =0;
856 virtual unsigned int GetEncodedElementSize(
bool reversible)
const =0;
864 virtual void EncodeElement(
bool reversible,
const Element &
element,
byte *encoded)
const =0;
872 virtual Element DecodeElement(
const byte *encoded,
bool checkForGroupMembership)
const =0;
878 virtual Integer ConvertElementToInteger(
const Element &element)
const =0;
913 virtual bool FastSubgroupCheckAvailable()
const =0;
921 virtual bool IsIdentity(
const Element &element)
const =0;
933 virtual void SimultaneousExponentiate(Element *results,
const Element &base,
const Integer *exponents,
unsigned int exponentsCount)
const =0;
946 template <
class GROUP_PRECOMP,
class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<
typename GROUP_PRECOMP::Element>,
class BASE = DL_GroupParameters<
typename GROUP_PRECOMP::Element> >
951 typedef typename GROUP_PRECOMP::Element
Element;
1003 return GetValueHelper(
this, name, valueType, pValue, &this->GetAbstractGroupParameters())
1010 virtual const Element &
GetPublicElement()
const {
return GetPublicPrecomputation().GetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation());}
1011 virtual void SetPublicElement(
const Element &y) {AccessPublicPrecomputation().SetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation(), y);}
1041 pub.
SetPublicElement(this->GetAbstractGroupParameters().ExponentiateBase(GetPrivateExponent()));
1046 return GetValueHelper(
this, name, valueType, pValue, &this->GetAbstractGroupParameters())
1052 this->AccessAbstractGroupParameters().AssignFrom(source);
1057 virtual const Integer & GetPrivateExponent()
const =0;
1058 virtual void SetPrivateExponent(
const Integer &
x) =0;
1069 this->AccessAbstractGroupParameters().AssignFrom(source);
1078 template <
class PK,
class GP,
class O = OID>
1088 {AccessGroupParameters().BERDecode(bt);
return true;}
1090 {GetGroupParameters().DEREncode(bt);
return true;}
1114 bool pass = GetAbstractGroupParameters().Validate(rng, level);
1116 const Integer &q = GetAbstractGroupParameters().GetSubgroupOrder();
1117 const Integer &
x = GetPrivateExponent();
1127 return GetValueHelper<DL_PrivateKey<Element> >(
this,
name, valueType, pValue).Assignable();
1132 AssignFromHelper<DL_PrivateKey<Element> >(
this,
source);
1138 this->AccessGroupParameters().GenerateRandom(rng, params);
1140 SetPrivateExponent(x);
1146 {AccessAbstractGroupParameters().Precompute(precomputationStorage);}
1149 {AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation);}
1152 {GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);}
1164 {m_x.BERDecode(bt);}
1166 {m_x.DEREncode(bt);}
1173 template <
class BASE,
class SIGNATURE_SCHEME>
1181 BASE::GenerateRandom(rng, params);
1185 typename SIGNATURE_SCHEME::Signer signer(*
this);
1186 typename SIGNATURE_SCHEME::Verifier verifier(signer);
1204 bool pass = GetAbstractGroupParameters().Validate(rng, level);
1205 pass = pass && GetAbstractGroupParameters().ValidateElement(level, this->GetPublicElement(), &GetPublicPrecomputation());
1211 return GetValueHelper<DL_PublicKey<Element> >(
this,
name, valueType, pValue).Assignable();
1216 AssignFromHelper<DL_PublicKey<Element> >(
this,
source);
1223 AccessAbstractGroupParameters().Precompute(precomputationStorage);
1224 AccessPublicPrecomputation().Precompute(GetAbstractGroupParameters().GetGroupPrecomputation(), GetAbstractGroupParameters().GetSubgroupOrder().BitCount(), precomputationStorage);
1229 AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation);
1230 AccessPublicPrecomputation().Load(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation);
1235 GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);
1236 GetPublicPrecomputation().Save(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation);
1267 throw NotImplemented(
"DL_ElgamalLikeSignatureAlgorithm: this signature scheme does not support message recovery");
1299 virtual Element AgreeWithStaticPrivateKey(
const DL_GroupParameters<Element> ¶ms,
const Element &publicElement,
bool validateOtherPublicKey,
const Integer &privateExponent)
const =0;
1311 virtual void Derive(
const DL_GroupParameters<T> &groupParams,
byte *derivedKey,
size_t derivedLength,
const T &agreedElement,
const T &ephemeralPublicKey,
const NameValuePairs &derivationParams)
const =0;
1322 virtual size_t GetSymmetricKeyLength(
size_t plaintextLength)
const =0;
1323 virtual size_t GetSymmetricCiphertextLength(
size_t plaintextLength)
const =0;
1324 virtual size_t GetMaxSymmetricPlaintextLength(
size_t ciphertextLength)
const =0;
1343 virtual KeyInterface & AccessKeyInterface() =0;
1344 virtual const KeyInterface & GetKeyInterface()
const =0;
1352 template <
class INTFACE,
class KEY_INTFACE>
1363 return GetSignatureAlgorithm().RLen(this->GetAbstractGroupParameters())
1364 + GetSignatureAlgorithm().SLen(this->GetAbstractGroupParameters());
1370 {
return GetMessageEncodingInterface().MaxRecoverableLength(0, GetHashIdentifier().second, GetDigestSize());}
1387 {
return GetMessageEncodingInterface().AllowNonrecoverablePart();}
1392 {
return GetMessageEncodingInterface().RecoverablePartFirst();}
1404 virtual size_t GetDigestSize()
const =0;
1434 this->GetMessageEncodingInterface().ProcessRecoverableMessage(ma.
AccessHash(),
1435 recoverableMessage, recoverableMessageLength,
1442 this->GetMaterial().DoQuickSanityCheck();
1449 SecByteBlock representative(this->MessageRepresentativeLength());
1450 this->GetMessageEncodingInterface().ComputeMessageRepresentative(
1454 representative, this->MessageRepresentativeBitLength());
1489 size_t rLen = alg.
RLen(params);
1490 r.Encode(signature, rLen);
1494 RestartMessageAccumulator(rng, ma);
1496 return this->SignatureLength();
1531 size_t rLen = alg.
RLen(params);
1540 this->GetMaterial().DoQuickSanityCheck();
1547 SecByteBlock representative(this->MessageRepresentativeLength());
1550 representative, this->MessageRepresentativeBitLength());
1555 return alg.
Verify(params, key,
e, r, ma.
m_s);
1560 this->GetMaterial().DoQuickSanityCheck();
1567 SecByteBlock representative(this->MessageRepresentativeLength());
1568 this->GetMessageEncodingInterface().ComputeMessageRepresentative(
1572 representative, this->MessageRepresentativeBitLength());
1580 return this->GetMessageEncodingInterface().RecoverMessageFromSemisignature(
1591 template <
class PK,
class KI>
1601 unsigned int minLen = this->GetAbstractGroupParameters().GetEncodedElementSize(
true);
1602 return ciphertextLength < minLen ? 0 : GetSymmetricEncryptionAlgorithm().GetMaxSymmetricPlaintextLength(ciphertextLength - minLen);
1607 size_t len = GetSymmetricEncryptionAlgorithm().GetSymmetricCiphertextLength(plaintextLength);
1608 return len == 0 ? 0 : this->GetAbstractGroupParameters().GetEncodedElementSize(
true) + len;
1612 {
return GetKeyDerivationAlgorithm().ParameterSupported(name) || GetSymmetricEncryptionAlgorithm().ParameterSupported(name);}
1643 ciphertext += elementSize;
1644 ciphertextLength -= elementSize;
1682 ciphertext += elementSize;
1696 template <
class T1,
class T2>
1701 typedef typename GroupParameters::Element
Element;
1707 template <
class T1,
class T2>
1721 template <
class T1,
class T2,
class T3,
class T4,
class T5>
1735 template <
class T1,
class T2,
class T3,
class T4,
class T5>
1747 template <
class BASE,
class SCHEME_OPTIONS,
class KEY>
1770 typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup;
1776 return H::DIGESTSIZE;
1787 template <
class BASE,
class SCHEME_OPTIONS,
class KEY>
1812 template <
class SCHEME_OPTIONS>
1819 this->RestartMessageAccumulator(rng, *p);
1826 template <
class SCHEME_OPTIONS>
1838 template <
class SCHEME_OPTIONS>
1845 template <
class SCHEME_OPTIONS>
1863 unsigned int AgreedValueLength()
const {
return GetAbstractGroupParameters().GetEncodedElementSize(
false);}
1864 unsigned int PrivateKeyLength()
const {
return GetAbstractGroupParameters().GetSubgroupOrder().ByteCount();}
1865 unsigned int PublicKeyLength()
const {
return GetAbstractGroupParameters().GetEncodedElementSize(
true);}
1870 x.
Encode(privateKey, PrivateKeyLength());
1877 Integer x(privateKey, PrivateKeyLength());
1882 bool Agree(
byte *agreedValue,
const byte *privateKey,
const byte *otherPublicKey,
bool validateOtherPublicKey=
true)
const 1887 Integer x(privateKey, PrivateKeyLength());
1888 Element w = params.
DecodeElement(otherPublicKey, validateOtherPublicKey);
1890 Element
z = GetKeyAgreementAlgorithm().AgreeWithStaticPrivateKey(
1891 GetAbstractGroupParameters(), w, validateOtherPublicKey, x);
1903 const Element &
GetGenerator()
const {
return GetAbstractGroupParameters().GetSubgroupGenerator();}
1932 template <
class ELEMENT,
class COFACTOR_OPTION>
1963 if (!validateOtherPublicKey)
1988 template <
class BASE>
1995 {this->AccessKey().AssignFrom(key);}
1998 {this->AccessKey().BERDecode(bt);}
2001 {this->AccessKey().AssignFrom(algorithm.
GetMaterial());}
2004 {this->AccessKey().Initialize(v1);}
2006 template <
class T1,
class T2>
2008 {this->AccessKey().Initialize(v1, v2);}
2010 template <
class T1,
class T2,
class T3>
2012 {this->AccessKey().Initialize(v1, v2, v3);}
2014 template <
class T1,
class T2,
class T3,
class T4>
2016 {this->AccessKey().Initialize(v1, v2, v3, v4);}
2018 template <
class T1,
class T2,
class T3,
class T4,
class T5>
2020 {this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
2022 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
2024 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
2026 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
2028 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
2030 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8>
2031 PK_FinalTemplate(
const T1 &v1,
const T2 &v2,
const T3 &v3,
const T4 &v4,
const T5 &v5,
const T6 &v6,
const T7 &v7,
const T8 &v8)
2032 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
2034 template <
class T1,
class T2>
2036 {this->AccessKey().Initialize(v1, v2);}
2038 template <
class T1,
class T2,
class T3>
2040 {this->AccessKey().Initialize(v1, v2, v3);}
2042 template <
class T1,
class T2,
class T3,
class T4>
2044 {this->AccessKey().Initialize(v1, v2, v3, v4);}
2046 template <
class T1,
class T2,
class T3,
class T4,
class T5>
2048 {this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
2050 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
2052 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
2054 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
2056 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
2058 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8>
2060 {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
2077 template <
class KEYS,
class STANDARD,
class ALG_INFO>
2080 template <
class KEYS,
class STANDARD,
class ALG_INFO = TF_ES<KEYS, STANDARD,
int> >
2081 class TF_ES :
public KEYS
2104 template <
class KEYS,
class STANDARD,
class H,
class ALG_INFO>
2107 template <
class KEYS,
class STANDARD,
class H,
class ALG_INFO = TF_SS<KEYS, STANDARD, H,
int> >
2108 class TF_SS :
public KEYS
2116 static std::string
CRYPTOPP_API StaticAlgorithmName() {
return std::string(KEYS::StaticAlgorithmName()) +
"/" + MessageEncodingMethod::StaticAlgorithmName() +
"(" + H::StaticAlgorithmName() +
")";}
2131 template <
class KEYS,
class SA,
class MEM,
class H,
class ALG_INFO>
2134 template <
class KEYS,
class SA,
class MEM,
class H,
class ALG_INFO = DL_SS<KEYS, SA, MEM, H,
int> >
2135 class DL_SS :
public KEYS
2140 static std::string
StaticAlgorithmName() {
return SA::StaticAlgorithmName() + std::string(
"/EMSA1(") + H::StaticAlgorithmName() +
")";}
2154 template <
class KEYS,
class AA,
class DA,
class EA,
class ALG_INFO>
2168 #if CRYPTOPP_MSC_VERSION 2169 # pragma warning(pop) void DEREncodePrivateKey(BufferedTransformation &bt) const
encode privateKey part of privateKeyInfo, without the OCTET STRING header
virtual size_t GetMaxSymmetricPlaintextLength(size_t ciphertextLength) const =0
const KeyClass & GetTrapdoorFunction() const
const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const
DL_PrivateKey< T > ThisClass
Standard names for retrieving values by name when working with NameValuePairs.
GP::BasePrecomputation m_ypc
virtual const CryptoMaterial & GetMaterial() const =0
Retrieves a reference to CryptoMaterial.
Keys::PrivateKey PrivateKey
bool IsProbabilistic() const
Determines if the scheme is probabilistic.
Discrete Log (DL) key options.
bool GetThisObject(T &object) const
Get a copy of this object or subobject.
Applies the trapdoor function, using random data if required.
Keys::PrivateKey PrivateKey
const KEY & GetKey() const
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6)
virtual void SymmetricEncrypt(RandomNumberGenerator &rng, const byte *key, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters) const =0
PK_FinalTemplate< DL_DecryptorImpl< SchemeOptions > > Decryptor
implements PK_Decryptor interface
void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs ¶meters=g_nullNameValuePairs) const
Encrypt a byte string.
bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
virtual Element Exponentiate(const DL_GroupPrecomputation< Element > &group, const Integer &exponent) const =0
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
bool RecoverablePartFirst() const
virtual bool RecoverablePartFirst() const
Interface for asymmetric algorithms.
Interface for message encoding method for public key signature schemes.
Trapdoor Function (TF) encryption scheme.
Diffie-Hellman key agreement algorithm.
SCHEME_OPTIONS SchemeOptions
virtual void Derive(const DL_GroupParameters< T > &groupParams, byte *derivedKey, size_t derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs &derivationParams) const =0
const PublicKey & GetPublicKey() const
void SetPrivateExponent(const Integer &x)
const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const
PK_FinalTemplate(const T1 &v1, const T2 &v2)
#define CRYPTOPP_STATIC_CONSTEXPR
size_t MessageRepresentativeLength() const
void SignaturePairwiseConsistencyTest_FIPS_140_Only(const PK_Signer &signer, const PK_Verifier &verifier)
Restricts the instantiation of a class to one static object without locks.
Discrete Log (DL) signer implementation.
Element AgreeWithStaticPrivateKey(const DL_GroupParameters< Element > ¶ms, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const
bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
PK_FinalTemplate(const AsymmetricAlgorithm &algorithm)
PK_FinalTemplate(const CryptoMaterial &key)
void Encode(byte *output, size_t outputLen, Signedness sign=UNSIGNED) const
Encode in big-endian format.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
PK_MessageAccumulator * NewVerificationAccumulator() const
Create a new HashTransformation to accumulate the message to be verified.
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7)
DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters=g_nullNameValuePairs) const
Decrypt a byte string.
BASE_PRECOMP BasePrecomputation
size_t BitsToBytes(size_t bitCount)
Returns the number of 8-bit bytes or octets required for the specified number of bits.
Interface for deterministic signers.
virtual DecodingResult RecoverMessageFromRepresentative(HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, byte *representative, size_t representativeBitLength, byte *recoveredMessage) const
PK_FinalTemplate< TF_VerifierImpl< SchemeOptions > > Verifier
implements PK_Verifier interface
bool IsProbabilistic() const
virtual size_t MinRepresentativeBitLength(size_t hashIdentifierLength, size_t digestLength) const
PK_FinalTemplate< TF_EncryptorImpl< SchemeOptions > > Encryptor
implements PK_Encryptor interface
SecByteBlock m_recoverableMessage
PK_FinalTemplate(BufferedTransformation &bt)
virtual Element CascadeExponentiateBaseAndPublicElement(const Integer &baseExp, const Integer &publicExp) const
static Integer CRYPTOPP_API Gcd(const Integer &a, const Integer &n)
greatest common divisor
const BASE::TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const
Encodes and decodesprivateKeyInfo.
void BERDecodePrivateKey(BufferedTransformation &bt, bool, size_t)
decode privateKey part of privateKeyInfo, without the OCTET STRING header
virtual void SetSubgroupGenerator(const Element &base)
Set the subgroup generator.
#define NAMESPACE_BEGIN(x)
The base for trapdoor based cryptosystems.
bool FIPS_140_2_ComplianceEnabled()
Determines whether the library provides FIPS validated cryptography.
Interface for Discrete Log (DL) group parameters.
virtual void ProcessRecoverableMessage(HashTransformation &hash, const byte *recoverableMessage, size_t recoverableMessageLength, const byte *presignature, size_t presignatureLength, SecByteBlock &semisignature) const
CofactorMultiplicationOption
Methods for avoiding "Small-Subgroup" attacks on Diffie-Hellman Key Agreement.
T4 KeyDerivationAlgorithm
Converts an enumeration to a type suitable for use as a template parameter.
Interface for message encoding method for public key signature schemes.
virtual bool IsRandomized() const
Determines if the decryption algorithm is randomized.
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
virtual ~DL_PrivateKey_WithSignaturePairwiseConsistencyTest()
Abstract base classes that provide a uniform interface to this library.
KeyClass m_trapdoorFunction
const PrivateKey & GetPrivateKey() const
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
virtual ~TF_DecryptorBase()
size_t CiphertextLength(size_t plaintextLength) const
virtual DecodingResult RecoverMessageFromSemisignature(HashTransformation &hash, HashIdentifier hashIdentifier, const byte *presignature, size_t presignatureLength, const byte *semisignature, size_t semisignatureLength, byte *recoveredMessage) const
virtual Integer ConvertElementToInteger(const Element &element) const =0
Converts an element to an Integer.
size_type size() const
Provides the count of elements in the SecBlock.
const Element & GetGenerator() const
Retrieves a reference to the group generator.
bool IsRandomized() const
Determines if the encryption algorithm is randomized.
HashIdentifier GetHashIdentifier() const
PK_MessageAccumulator * NewVerificationAccumulator() const
size_t FixedCiphertextLength() const
static std::string CRYPTOPP_API StaticAlgorithmName()
CRYPTOPP_DLL void CRYPTOPP_API P1363_MGF1KDF2_Common(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, const byte *derivationParams, size_t derivationParamsLength, bool mask, unsigned int counterStart)
Message encoding method for public key encryption.
Interface for key derivation algorithms used in DL cryptosystems.
virtual void Sign(const DL_GroupParameters< T > ¶ms, const Integer &privateKey, const Integer &k, const Integer &e, Integer &r, Integer &s) const =0
Classes for automatic resource management.
Integer CalculateRandomizedInverse(RandomNumberGenerator &rng, const Integer &x) const
Applies the inverse of the trapdoor function.
virtual Element ExponentiatePublicElement(const Integer &exponent) const
Library configuration file.
size_t PaddedBlockBitLength() const
Interface for Discrete Log (DL) private keys.
virtual bool ParameterSupported(const char *name) const
bool RecoverablePartFirst() const
Determines if the scheme allows recoverable part first.
virtual bool CanIncorporateEntropy() const
Determines if a generator can accept additional entropy.
Ring of congruence classes modulo n.
virtual ~DL_EncryptorBase()
size_t SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const
Sign and restart messageAccumulator.
EnumToType< CofactorMultiplicationOption, NO_COFACTOR_MULTIPLICTION > NoCofactorMultiplication
Interface for random number generators.
PK_FinalTemplate(const Integer &v1)
size_t MaxPlaintextLength(size_t ciphertextLength) const
void Randomize(RandomNumberGenerator &rng, size_t bitCount)
Set this Integer to random integer.
Discrete Log (DL) base interface.
void New(size_type newSize)
Change size without preserving contents.
Trapdoor function cryptosystems decryption base class.
Discrete Log (DL) scheme options.
const DL_GroupParameters< Element > & GetAbstractGroupParameters() const
Retrieves abstract group parameters.
virtual size_t MaxRecoverableLength(size_t representativeBitLength, size_t hashIdentifierLength, size_t digestLength) const
Discrete Log (DL) encryption scheme.
PK_FinalTemplate(T1 &v1, const T2 &v2)
Discrete Log (DL) crypto scheme options.
DL_PublicKey< T > ThisClass
STANDARD::EncryptionMessageEncodingMethod MessageEncodingMethod
TF_SignatureSchemeOptions< ALG_INFO, KEYS, MessageEncodingMethod, H > SchemeOptions
Classes for performing mathematics over different fields.
STANDARD Standard
see SignatureStandard for a list of standards
virtual ~DL_KeyAgreementAlgorithm()
Provides range for plaintext and ciphertext lengths.
Interface for private keys.
const KeyClass & GetKey() const
DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const
Recover a message from its signature.
virtual Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters< Element > ¶ms, const DL_FixedBasePrecomputation< Element > &publicPrecomputation, const Integer &privateExponent) const =0
virtual ~TF_VerifierBase()
void MakePublicKey(DL_PublicKey< T > &pub) const
bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const
Check whether messageAccumulator contains a valid signature and message, and restart messageAccumulat...
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
static const Integer &CRYPTOPP_API One()
Integer representing 1.
size_t MaxPlaintextLength(size_t ciphertextLength) const
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
virtual ~MaskGeneratingFunction()
virtual ~DeterministicSignatureAlgorithm()
const DL_KeyAgreementAlgorithm< Element > & GetKeyAgreementAlgorithm() const
Interface for Discrete Log (DL) public keys.
void SetKeyPtr(const KEY *pKey)
void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const
Generate private key in this domain.
Base class for public key signature standard classes.
virtual const Element & GetSubgroupGenerator() const
Retrieves the subgroup generator.
const DL_GroupParameters< Element > & GetAbstractGroupParameters() const
static HashIdentifier CRYPTOPP_API Lookup()
size_t CiphertextLength(size_t plaintextLength) const
CryptoParameters & AccessCryptoParameters()
Retrieves a reference to Crypto Parameters.
Pointer that overloads operator ->
virtual ~DL_CryptoSystemBase()
void Precompute(unsigned int precomputationStorage=16)
Perform precomputation.
virtual void SetPublicElement(const Element &y)
Discrete Log (DL) signature scheme.
const DL_FixedBasePrecomputation< Element > & GetBasePrecomputation() const
Retrieves the group precomputation.
unsigned int PublicKeyLength() const
Provides the size of the public key.
const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const
unsigned int AgreedValueLength() const
Provides the size of the agreed value.
virtual Integer MaxPreimage() const
Returns the maximum size of a message before the trapdoor function is applied bound to a public key...
virtual size_t RLen(const DL_GroupParameters< T > ¶ms) const
Base class for a Discrete Log (DL) key.
Interface for domains of simple key agreement protocols.
Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters< Element > ¶ms, const DL_FixedBasePrecomputation< Element > &publicPrecomputation, const Integer &privateExponent) const
HashIdentifier GetHashIdentifier() const
const GP & GetGroupParameters() const
Applies the inverse of the trapdoor function.
Returns a decoding results.
Uses encapsulation to hide an object in derived classes.
virtual bool IsDeterministic() const
size_t GetDigestSize() const
Standard::SignatureMessageEncodingMethod MessageEncodingMethod
virtual const DL_FixedBasePrecomputation< T > & GetPublicPrecomputation() const =0
bool IsPositive() const
Determines if the Integer is positive.
size_t MessageRepresentativeBitLength() const
DL_FixedBasePrecomputation< Element > & AccessBasePrecomputation()
Retrieves the group precomputation.
static std::string StaticAlgorithmName()
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
Create a new HashTransformation to accumulate the message to be signed.
P1363 mask generation function.
void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
MEI MessageEncodingInterface
void RawSign(const Integer &k, const Integer &e, Integer &r, Integer &s) const
Testing interface.
const DL_ElgamalLikeSignatureAlgorithm< Element > & GetSignatureAlgorithm() const
bool GetThisPointer(T *&ptr) const
Get a pointer to this object.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
PK_FinalTemplate< TF_SignerImpl< SchemeOptions > > Signer
implements PK_Signer interface
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
A method was called which was not implemented.
bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms)
virtual ~PK_FixedLengthCryptoSystemImpl()
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
virtual ~TF_ObjectImplExtRef()
Interface for Elgamal-like signature algorithms.
const KEY & GetKey() const
No cofactor multiplication applied.
virtual ~DL_PublicKeyImpl()
Discrete Log (DL) signature scheme signer base implementation.
virtual ~DL_KeyAgreementAlgorithm_DH()
Interface for message encoding method for public key signature schemes.
bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const
Derive agreed value.
virtual bool Verify(const DL_GroupParameters< T > ¶ms, const DL_PublicKey< T > &publicKey, const Integer &e, const Integer &r, const Integer &s) const =0
virtual ~DL_GroupParameters()
virtual const DL_FixedBasePrecomputation< Element > & GetBasePrecomputation() const =0
Retrieves the group precomputation.
Interface for message encoding method for public key signature schemes.
const Integer & GetPrivateExponent() const
virtual void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const =0
Exponentiates a base to multiple exponents.
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
void Assign(const T *ptr, size_type len)
Set contents and size from an array.
Base class for public key encryption standard classes.
DL_GroupParameters< T > ThisClass
virtual ~DL_SignatureSchemeBase()
Discrete Log (DL) object implementation.
SCHEME_OPTIONS SchemeOptions
void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
Multiple precision integer with arithmetic operations.
virtual const Element & GetPublicElement() const
size_t GetDigestSize() const
Discrete Log (DL) verifier implementation.
void Divide(word *R, word *Q, word *T, const word *A, size_t NA, const word *B, size_t NB)
void Precompute(unsigned int precomputationStorage=16)
Perform precomputation.
virtual size_t GetSymmetricKeyLength(size_t plaintextLength) const =0
virtual ~DL_ElgamalLikeSignatureAlgorithm()
T1 SaturatingSubtract(const T1 &a, const T2 &b)
Performs a saturating subtract clamped at 0.
Keys::PublicKey PublicKey
Discrete Log (DL) signature scheme base implementation.
bool BERDecodeAlgorithmParameters(BufferedTransformation &bt)
virtual ~TrapdoorFunction()
virtual Integer MaxImage() const
Returns the maximum size of a message after the trapdoor function is applied bound to a public key...
Discrete Log (DL) base object implementation.
bool ParameterSupported(const char *name) const
virtual ~DL_SymmetricEncryptionAlgorithm()
Applies the trapdoor function.
const DL_GroupParameters< Element > & GetAbstractGroupParameters() const
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6)
Discrete Log (DL) cryptosystem base implementation.
unsigned int PrivateKeyLength() const
Provides the size of the private key.
const DL_GroupPrecomputation< Element > & GetGroupPrecomputation() const
Retrieves the group precomputation.
virtual Element DecodeElement(const byte *encoded, bool checkForGroupMembership) const =0
Decodes the element.
void Precompute(unsigned int precomputationStorage=16)
Perform precomputation.
virtual ~DL_DecryptorBase()
Mask generation function interface.
AssignFromHelperClass< T, BASE > AssignFromHelper(T *pObject, const NameValuePairs &source)
virtual bool FastSubgroupCheckAvailable() const =0
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
PK_FinalTemplate< DL_EncryptorImpl< SchemeOptions > > Encryptor
implements PK_Encryptor interface
bool AllowNonrecoverablePart() const
Determines if the scheme has non-recoverable part.
virtual bool ParameterSupported(const char *name) const
void AssignFrom(const NameValuePairs &source)
virtual DecodingResult SymmetricDecrypt(const byte *key, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs ¶meters) const =0
Public key trapdoor function default implementation.
bool operator==(const DL_PublicKeyImpl< GP > &rhs) const
virtual bool IsDeterministic() const
virtual ~DL_VerifierBase()
const DL_FixedBasePrecomputation< Element > & GetPublicPrecomputation() const
Exception thrown when an invalid group element is encountered.
virtual Integer GetCofactor() const
Retrieves the cofactor.
static std::string CRYPTOPP_API StaticAlgorithmName()
void AssignFrom(const NameValuePairs &source)
#define CRYPTOPP_ASSERT(exp)
virtual ~TrapdoorFunctionBounds()
DL_CryptoSchemeOptions< ALG_INFO, KEYS, AA, DA, EA > SchemeOptions
const NameValuePairs & g_nullNameValuePairs
An empty set of name-value pairs.
DL_GroupParameters< Element > & AccessAbstractGroupParameters()
virtual bool ValidateElement(unsigned int level, const Element &element, const DL_FixedBasePrecomputation< Element > *precomp) const =0
Check the element for errors.
HashTransformation HashFunction
TF_CryptoSchemeOptions< ALG_INFO, KEYS, MessageEncodingMethod > SchemeOptions
DL_Base< KI >::Element Element
virtual HashTransformation & AccessHash()=0
bool AllowNonrecoverablePart() const
virtual size_t SLen(const DL_GroupParameters< T > ¶ms) const
const DL_KeyDerivationAlgorithm< Element > & GetKeyDerivationAlgorithm() const
void GenerateAndMask(HashTransformation &hash, byte *output, size_t outputLength, const byte *input, size_t inputLength, bool mask=true) const
Generate and apply mask.
#define CRYPTOPP_NO_VTABLE
virtual ~DL_KeyDerivationAlgorithm()
virtual Integer GenerateRandom(const Integer &x, const Integer &q, const Integer &e) const =0
size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const
bool IsRandomized() const
Determines if the decryption algorithm is randomized.
void Update(const byte *input, size_t length)
Updates a hash with additional input.
Implementation of BufferedTransformation's attachment interface.
DL_GroupParameters< Element > & AccessAbstractGroupParameters()
Retrieves abstract group parameters.
#define CRYPTOPP_SET_FUNCTION_ENTRY(name)
DL_FixedBasePrecomputation< Element > & AccessPublicPrecomputation()
void InputRecoverableMessage(PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const
Input a recoverable message to an accumulator.
virtual ~DL_GroupParametersImpl()
Interface for accumulating messages to be signed or verified.
virtual ~DL_SimpleKeyAgreementDomainBase()
Discrete Log (DL) encryptor base implementation.
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
Get a named value.
const BASE::KeyInterface & GetKeyInterface() const
virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters< Element > ¶ms, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0
Classes for precomputation in a group.
void AssignFrom(const NameValuePairs &source)
Assign values to this object.
PublicKey & AccessPublicKey()
virtual const Integer & GetPrivateExponent() const =0
EnumToType< CofactorMultiplicationOption, COMPATIBLE_COFACTOR_MULTIPLICTION > CompatibleCofactorMultiplication
PK_FinalTemplate< DL_SignerImpl< SchemeOptions > > Signer
implements PK_Signer interface
void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
BASE::KeyInterface & AccessKeyInterface()
#define pass(a, b, c, mul, X)
virtual const DL_GroupPrecomputation< Element > & GetGroupPrecomputation() const =0
Retrieves the group precomputation.
PK_MessageAccumulatorBase()
Classes and functions for the FIPS 140-2 validated library.
size_t SignatureLength() const
Provides the signature length.
#define CRYPTOPP_GET_FUNCTION_ENTRY(name)
size_t MaxRecoverableLength() const
Provides the maximum recoverable length.
void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
Generate a public key from a private key in this domain.
PrivateKey & AccessPrivateKey()
HashTransformation & AccessHash()
DL_SignatureSchemeOptions< ALG_INFO, KEYS, SA, MEM, H > SchemeOptions
virtual ~TF_EncryptorBase()
GROUP_PRECOMP m_groupPrecomputation
#define CRYPTOPP_UNUSED(x)
virtual ~RandomizedTrapdoorFunctionInverse()
RandomNumberGenerator & NullRNG()
Random Number Generator that does not produce random numbers.
virtual void ProcessSemisignature(HashTransformation &hash, const byte *semisignature, size_t semisignatureLength) const
PK_FinalTemplate< TF_DecryptorImpl< SchemeOptions > > Decryptor
implements PK_Decryptor interface
GP & AccessGroupParameters()
Interface for crypto material, such as public and private keys, and crypto parameters.
size_t MaxRecoverableLength() const
virtual void EncodeElement(bool reversible, const Element &element, byte *encoded) const =0
Encodes the element.
size_t SignatureLength() const
bool Lookup(const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
virtual bool ParameterSupported(const char *name) const
const DL_GroupParameters< Element > & GetAbstractGroupParameters() const
Retrieves abstract group parameters.
bytes padded(bytes _b, unsigned _l)
Add '0' on, or remove items from, the front of _b until it is of length _l.
DL_GroupParameters< Element > & AccessAbstractGroupParameters()
Retrieves abstract group parameters.
virtual unsigned int GetEncodedElementSize(bool reversible) const =0
Retrieves the encoded element's size.
void Decode(const byte *input, size_t inputLen, Signedness sign=UNSIGNED)
Decode from big-endian byte array.
Discrete Log (DL) encryptor implementation.
Multiple precision integer with arithmetic operations.
GROUP_PRECOMP::Element Element
static const Integer &CRYPTOPP_API Zero()
Integer representing 0.
const BASE::MessageEncodingInterface & GetMessageEncodingInterface() const
Interface for crypto prameters.
virtual Integer GetMaxExponent() const =0
Retrieves the maximum exponent for the group.
Discrete Log (DL) decryptor implementation.
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7)
std::vector< char * > parameters
virtual bool IsRandomized() const
Determines if the encryption algorithm is randomized.
bool ParameterSupported(const char *name) const
TFI TrapdoorFunctionInterface
TF_ObjectImplExtRef(const KEY *pKey=NULL)
virtual ~PK_SignatureMessageEncodingMethod()
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
virtual ~TrapdoorFunctionInverse()
void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
Class file for performing modular arithmetic.
Interface for public keys.
Applies the inverse of the trapdoor function, using random data if required.
void RestartMessageAccumulator(RandomNumberGenerator &rng, PK_MessageAccumulatorBase &ma) const
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Check this object for errors.
std::pair< const byte *, unsigned int > HashIdentifier
Interface for symmetric encryption algorithms used in DL cryptosystems.
size_t FixedMaxPlaintextLength() const
EnumToType< CofactorMultiplicationOption, INCOMPATIBLE_COFACTOR_MULTIPLICTION > IncompatibleCofactorMultiplication
Base implementation of Discrete Log (DL) group parameters.
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms)
Generate a random key or crypto parameters.
void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
Save precomputation for later use.
virtual ~TF_ObjectImplBase()
Encodes and decodes subjectPublicKeyInfo.
Trapdoor function cryptosystem base class.
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3)
virtual ~TF_CryptoSystemBase()
Cofactor multiplication incompatible with ordinary Diffie-Hellman.
virtual ~TF_SignatureSchemeBase()
PublicKey & AccessPublicKey()
virtual Integer RecoverPresignature(const DL_GroupParameters< T > ¶ms, const DL_PublicKey< T > &publicKey, const Integer &r, const Integer &s) const
PrivateKey & AccessPrivateKey()
virtual DL_GroupParameters< T > & AccessAbstractGroupParameters()=0
Retrieves abstract group parameters.
size_t MessageRepresentativeBitLength() const
void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
Retrieve previously saved precomputation.
virtual Element ExponentiateBase(const Integer &exponent) const
Retrieves the subgroup generator.
SecByteBlock m_presignature
size_t MessageRepresentativeLength() const
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
T5 SymmetricEncryptionAlgorithm
PK_FinalTemplate< DL_VerifierImpl< SchemeOptions > > Verifier
implements PK_Verifier interface
Discrete Log (DL) signature scheme options.
Cofactor multiplication compatible with ordinary Diffie-Hellman.
GROUP_PRECOMP GroupPrecomputation
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
Interface for message encoding method for public key signature schemes.
size_t PaddedBlockByteLength() const
bool IsProbabilistic() const
Determines whether an encoding method requires a random number generator.
GroupParameters::Element Element
virtual ~PK_EncryptionMessageEncodingMethod()
bool AllowNonrecoverablePart() const
bool SupportsPrecomputation() const
Determines whether the object supports precomputation.
virtual ~RandomizedTrapdoorFunction()
Discrete Log (DL) decryptor base implementation.
Interface for message encoding method for public key signature schemes.
virtual Element ExponentiateElement(const Element &base, const Integer &exponent) const
Exponentiates an element.
Interface for DL key agreement algorithms.
unsigned int m_validationLevel
static void CRYPTOPP_API DeriveKey(byte *output, size_t outputLength, const byte *input, size_t inputLength, const byte *derivationParams, size_t derivationParamsLength)
SecByteBlock m_semisignature
virtual ~DL_ObjectImplBase()
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3)
Integer ApplyRandomizedFunction(RandomNumberGenerator &rng, const Integer &x) const
Applies the trapdoor function.
unsigned int ByteCount() const
Determines the number of bytes required to represent the Integer.
Discrete Log (DL) simple key agreement base implementation.
void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, size_t signatureLength) const
Input signature into a message accumulator.
virtual bool IsIdentity(const Element &element) const =0
Determines if an element is an identity.
Keys::PublicKey PublicKey
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
STANDARD Standard
see EncryptionStandard for a list of standards
virtual void IncorporateEntropy(const byte *input, size_t length)
Update RNG state with additional unpredictable values.
Interface for message encoding method for public key signature schemes.
virtual ~DL_PrivateKeyImpl()
virtual Integer GetGroupOrder() const
Retrieves the order of the group.
size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const
Provides the maximum recoverable length.
Interface for retrieving values given their names.
Template implementing constructors for public key algorithm classes.
GetValueHelperClass< T, BASE > GetValueHelper(const T *pObject, const char *name, const std::type_info &valueType, void *pValue, const NameValuePairs *searchFirst=NULL)
HashIdentifier GetHashIdentifier() const
Trapdoor Function (TF) Signature Scheme.
virtual const Integer & GetSubgroupOrder() const =0
Retrieves the subgroup order.
Base class for identifying alogorithm.