Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
XTR-DH with key validation. More...
#include <xtrcrypt.h>
Public Member Functions | |
XTR_DH (const Integer &p, const Integer &q, const GFP2Element &g) | |
XTR_DH (RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits) | |
XTR_DH (BufferedTransformation &domainParams) | |
void | DEREncode (BufferedTransformation &domainParams) const |
bool | Validate (RandomNumberGenerator &rng, unsigned int level) const |
Check this object for errors. More... | |
bool | GetVoidValue (const char *name, const std::type_info &valueType, void *pValue) const |
Get a named value. More... | |
void | AssignFrom (const NameValuePairs &source) |
Assign values to this object. More... | |
CryptoParameters & | AccessCryptoParameters () |
Retrieves a reference to Crypto Parameters. More... | |
unsigned int | AgreedValueLength () const |
Provides the size of the agreed value. More... | |
unsigned int | PrivateKeyLength () const |
Provides the size of the private key. More... | |
unsigned int | PublicKeyLength () const |
Provides the size of the public key. More... | |
void | GeneratePrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
Generate private key in this domain. More... | |
void | GeneratePublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
Generate a public key from a private key in this domain. More... | |
bool | Agree (byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const |
Derive agreed value. More... | |
const Integer & | GetModulus () const |
const Integer & | GetSubgroupOrder () const |
const GFP2Element & | GetSubgroupGenerator () const |
void | SetModulus (const Integer &p) |
void | SetSubgroupOrder (const Integer &q) |
void | SetSubgroupGenerator (const GFP2Element &g) |
Public Member Functions inherited from SimpleKeyAgreementDomain | |
virtual unsigned int | AgreedValueLength () const =0 |
Provides the size of the agreed value. More... | |
virtual unsigned int | PrivateKeyLength () const =0 |
Provides the size of the private key. More... | |
virtual unsigned int | PublicKeyLength () const =0 |
Provides the size of the public key. More... | |
virtual void | GeneratePrivateKey (RandomNumberGenerator &rng, byte *privateKey) const =0 |
Generate private key in this domain. More... | |
virtual void | GeneratePublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0 |
Generate a public key from a private key in this domain. More... | |
virtual void | GenerateKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate a private/public key pair. More... | |
virtual bool | Agree (byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const =0 |
Derive agreed value. More... | |
Public Member Functions inherited from KeyAgreementAlgorithm | |
CryptoMaterial & | AccessMaterial () |
Retrieves a reference to Crypto Parameters. More... | |
const CryptoMaterial & | GetMaterial () const |
Retrieves a reference to Crypto Parameters. More... | |
virtual CryptoParameters & | AccessCryptoParameters ()=0 |
Retrieves a reference to Crypto Parameters. More... | |
virtual const CryptoParameters & | GetCryptoParameters () const |
Retrieves a reference to Crypto Parameters. More... | |
virtual CryptoMaterial & | AccessMaterial ()=0 |
Retrieves a reference to CryptoMaterial. More... | |
virtual const CryptoMaterial & | GetMaterial () const =0 |
Retrieves a reference to CryptoMaterial. More... | |
Public Member Functions inherited from Algorithm | |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. More... | |
virtual std::string | AlgorithmName () const |
Provides the name of this algorithm. More... | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. More... | |
Public Member Functions inherited from Clonable | |
virtual Clonable * | Clone () const |
Copies this object. More... | |
Public Member Functions inherited from GeneratableCryptoMaterial | |
virtual void | GenerateRandom (RandomNumberGenerator &rng, const NameValuePairs ¶ms=g_nullNameValuePairs) |
Generate a random key or crypto parameters. More... | |
void | GenerateRandomWithKeySize (RandomNumberGenerator &rng, unsigned int keySize) |
Generate a random key or crypto parameters. More... | |
Public Member Functions inherited from CryptoMaterial | |
virtual void | AssignFrom (const NameValuePairs &source)=0 |
Assign values to this object. More... | |
virtual bool | Validate (RandomNumberGenerator &rng, unsigned int level) const =0 |
Check this object for errors. More... | |
virtual void | ThrowIfInvalid (RandomNumberGenerator &rng, unsigned int level) const |
Check this object for errors. More... | |
virtual void | Save (BufferedTransformation &bt) const |
Saves a key to a BufferedTransformation. More... | |
virtual void | Load (BufferedTransformation &bt) |
Loads a key from a BufferedTransformation. More... | |
virtual bool | SupportsPrecomputation () const |
Determines whether the object supports precomputation. More... | |
virtual void | Precompute (unsigned int precomputationStorage) |
Perform precomputation. More... | |
virtual void | LoadPrecomputation (BufferedTransformation &storedPrecomputation) |
Retrieve previously saved precomputation. More... | |
virtual void | SavePrecomputation (BufferedTransformation &storedPrecomputation) const |
Save precomputation for later use. More... | |
void | DoQuickSanityCheck () const |
Perform a quick sanity check. More... | |
Public Member Functions inherited from NameValuePairs | |
template<class T > | |
bool | GetThisObject (T &object) const |
Get a copy of this object or subobject. More... | |
template<class T > | |
bool | GetThisPointer (T *&ptr) const |
Get a pointer to this object. More... | |
template<class T > | |
bool | GetValue (const char *name, T &value) const |
Get a named value. More... | |
template<class T > | |
T | GetValueWithDefault (const char *name, T defaultValue) const |
Get a named value. More... | |
CRYPTOPP_DLL std::string | GetValueNames () const |
Get a list of value names that can be retrieved. More... | |
CRYPTOPP_DLL bool | GetIntValue (const char *name, int &value) const |
Get a named value with type int. More... | |
CRYPTOPP_DLL int | GetIntValueWithDefault (const char *name, int defaultValue) const |
Get a named value with type int, with default. More... | |
CRYPTOPP_DLL bool | GetWord64Value (const char *name, word64 &value) const |
Get a named value with type word64. More... | |
CRYPTOPP_DLL word64 | GetWord64ValueWithDefault (const char *name, word64 defaultValue) const |
Get a named value with type word64, with default. More... | |
template<class T > | |
void | GetRequiredParameter (const char *className, const char *name, T &value) const |
Retrieves a required name/value pair. More... | |
CRYPTOPP_DLL void | GetRequiredIntParameter (const char *className, const char *name, int &value) const |
Retrieves a required name/value pair. More... | |
virtual CRYPTOPP_DLL bool | GetVoidValue (const char *name, const std::type_info &valueType, void *pValue) const =0 |
Get a named value. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from NameValuePairs | |
static CRYPTOPP_DLL void | ThrowIfTypeMismatch (const char *name, const std::type_info &stored, const std::type_info &retrieving) |
Ensures an expected name and type is present. More... | |
XTR-DH with key validation.
Definition at line 15 of file xtrcrypt.h.
XTR_DH::XTR_DH | ( | const Integer & | p, |
const Integer & | q, | ||
const GFP2Element & | g | ||
) |
Definition at line 14 of file xtrcrypt.cpp.
XTR_DH::XTR_DH | ( | RandomNumberGenerator & | rng, |
unsigned int | pbits, | ||
unsigned int | qbits | ||
) |
Definition at line 19 of file xtrcrypt.cpp.
XTR_DH::XTR_DH | ( | BufferedTransformation & | domainParams | ) |
Definition at line 24 of file xtrcrypt.cpp.
void XTR_DH::DEREncode | ( | BufferedTransformation & | domainParams | ) | const |
Definition at line 34 of file xtrcrypt.cpp.
|
virtual |
Check this object for errors.
rng | a RandomNumberGenerator for objects which use randomized testing |
level | the level of thoroughness |
There are four levels of thoroughness:
Level 0 does not require a RandomNumberGenerator. A NullRNG() can be used for level 0. Level 1 may not check for weak keys and such. Levels 2 and 3 are recommended.
Implements CryptoMaterial.
Definition at line 44 of file xtrcrypt.cpp.
|
virtual |
Get a named value.
name | the name of the object or value to retrieve |
valueType | reference to a variable that receives the value |
pValue | void pointer to a variable that receives the value |
GetVoidValue() retrieves the value of name if it exists.
Implements NameValuePairs.
Definition at line 72 of file xtrcrypt.cpp.
|
virtual |
Assign values to this object.
This function can be used to create a public key from a private key.
Implements CryptoMaterial.
Definition at line 81 of file xtrcrypt.cpp.
|
inlinevirtual |
Retrieves a reference to Crypto Parameters.
Implements KeyAgreementAlgorithm.
Definition at line 29 of file xtrcrypt.h.
|
inlinevirtual |
Provides the size of the agreed value.
Implements SimpleKeyAgreementDomain.
Definition at line 30 of file xtrcrypt.h.
|
inlinevirtual |
Provides the size of the private key.
Implements SimpleKeyAgreementDomain.
Definition at line 31 of file xtrcrypt.h.
|
inlinevirtual |
Provides the size of the public key.
Implements SimpleKeyAgreementDomain.
Definition at line 32 of file xtrcrypt.h.
|
virtual |
Generate private key in this domain.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
COUNTOF(privateKey) == PrivateKeyLength()
Implements SimpleKeyAgreementDomain.
Definition at line 90 of file xtrcrypt.cpp.
|
virtual |
Generate a public key from a private key in this domain.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer with the previously generated private key |
publicKey | a byte buffer for the generated public key in this domain |
COUNTOF(publicKey) == PublicKeyLength()
Implements SimpleKeyAgreementDomain.
Definition at line 96 of file xtrcrypt.cpp.
|
virtual |
Derive agreed value.
agreedValue | a byte buffer for the shared secret |
privateKey | a byte buffer with your private key in this domain |
otherPublicKey | a byte buffer with the other party's public key in this domain |
validateOtherPublicKey | a flag indicating if the other party's public key should be validated |
Agree() derives an agreed value from your private keys and couterparty's public keys.
The other party's public key is validated by default. If you have previously validated the static public key, use validateStaticOtherPublicKey=false
to save time.
COUNTOF(agreedValue) == AgreedValueLength()
COUNTOF(privateKey) == PrivateKeyLength()
COUNTOF(otherPublicKey) == PublicKeyLength()
Implements SimpleKeyAgreementDomain.
Definition at line 104 of file xtrcrypt.cpp.
|
inline |
Definition at line 38 of file xtrcrypt.h.
|
inline |
Definition at line 39 of file xtrcrypt.h.
|
inline |
Definition at line 40 of file xtrcrypt.h.
|
inline |
Definition at line 42 of file xtrcrypt.h.
|
inline |
Definition at line 43 of file xtrcrypt.h.
|
inline |
Definition at line 44 of file xtrcrypt.h.