Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Fully Hashed Menezes-Qu-Vanstone in GF(p) More...
#include <fhmqv.h>
Public Types | |
typedef GROUP_PARAMETERS | GroupParameters |
typedef GroupParameters::Element | Element |
typedef FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH > | Domain |
Public Member Functions | |
FHMQV_Domain (bool clientRole=true) | |
Construct a FHMQV domain. More... | |
FHMQV_Domain (const GroupParameters ¶ms, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
FHMQV_Domain (BufferedTransformation &bt, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
template<class T1 > | |
FHMQV_Domain (T1 v1, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
template<class T1 , class T2 > | |
FHMQV_Domain (T1 v1, T2 v2, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
template<class T1 , class T2 , class T3 > | |
FHMQV_Domain (T1 v1, T2 v2, T3 v3, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
template<class T1 , class T2 , class T3 , class T4 > | |
FHMQV_Domain (T1 v1, T2 v2, T3 v3, T4 v4, bool clientRole=true) | |
Construct a FHMQV domain. More... | |
const GroupParameters & | GetGroupParameters () const |
Retrieves the group parameters for this domain. More... | |
GroupParameters & | AccessGroupParameters () |
Retrieves the group parameters for this domain. More... | |
CryptoParameters & | AccessCryptoParameters () |
Retrieves the crypto parameters for this domain. More... | |
unsigned int | AgreedValueLength () const |
Provides the size of the agreed value. More... | |
unsigned int | StaticPrivateKeyLength () const |
Provides the size of the static private key. More... | |
unsigned int | StaticPublicKeyLength () const |
Provides the size of the static public key. More... | |
void | GenerateStaticPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
Generate static private key in this domain. More... | |
void | GenerateStaticPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
Generate a static public key from a private key in this domain. More... | |
unsigned int | EphemeralPrivateKeyLength () const |
Provides the size of the ephemeral private key. More... | |
unsigned int | EphemeralPublicKeyLength () const |
Provides the size of the ephemeral public key. More... | |
void | GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
Generate ephemeral private key in this domain. More... | |
void | GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
Generate ephemeral public key from a private key in this domain. More... | |
bool | Agree (byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const |
Derive agreed value or shared secret. More... | |
Public Member Functions inherited from AuthenticatedKeyAgreementDomain | |
virtual unsigned int | AgreedValueLength () const =0 |
Provides the size of the agreed value. More... | |
virtual unsigned int | StaticPrivateKeyLength () const =0 |
Provides the size of the static private key. More... | |
virtual unsigned int | StaticPublicKeyLength () const =0 |
Provides the size of the static public key. More... | |
virtual void | GenerateStaticPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const =0 |
Generate static private key in this domain. More... | |
virtual void | GenerateStaticPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0 |
Generate a static public key from a private key in this domain. More... | |
virtual void | GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate a static private/public key pair. More... | |
virtual unsigned int | EphemeralPrivateKeyLength () const =0 |
Provides the size of ephemeral private key. More... | |
virtual unsigned int | EphemeralPublicKeyLength () const =0 |
Provides the size of ephemeral public key. More... | |
virtual void | GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const =0 |
Generate ephemeral private key. More... | |
virtual void | GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0 |
Generate ephemeral public key. More... | |
virtual void | GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate private/public key pair. More... | |
virtual bool | Agree (byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=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... | |
Fully Hashed Menezes-Qu-Vanstone in GF(p)
This implementation follows Augustin P. Sarr and Philippe Elbaz–Vincent, and Jean–Claude Bajard's A Secure and Efficient Authenticated Diffie-Hellman Protocol. Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
typedef GROUP_PARAMETERS FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GroupParameters |
typedef GroupParameters::Element FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Element |
typedef FHMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Domain |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
Construct a FHMQV domain.
bt | BufferedTransformation with group parameters and options |
clientRole | flag indicating initiator or recipient |
clientRole = true
indicates initiator, and clientRole = false
indicates recipient or server.
|
inline |
Construct a FHMQV domain.
T1 | template parameter used as a constructor parameter |
v1 | first parameter |
clientRole | flag indicating initiator or recipient |
v1 is passed directly to the GROUP_PARAMETERS object.
clientRole = true
indicates initiator, and clientRole = false
indicates recipient or server.
|
inline |
Construct a FHMQV domain.
T1 | template parameter used as a constructor parameter |
T2 | template parameter used as a constructor parameter |
v1 | first parameter |
v2 | second parameter |
clientRole | flag indicating initiator or recipient |
v1 and v2 are passed directly to the GROUP_PARAMETERS object.
clientRole = true
indicates initiator, and clientRole = false
indicates recipient or server.
|
inline |
Construct a FHMQV domain.
T1 | template parameter used as a constructor parameter |
T2 | template parameter used as a constructor parameter |
T3 | template parameter used as a constructor parameter |
v1 | first parameter |
v2 | second parameter |
v3 | third parameter |
clientRole | flag indicating initiator or recipient |
v1, v2 and v3 are passed directly to the GROUP_PARAMETERS object.
clientRole = true
indicates initiator, and clientRole = false
indicates recipient or server.
|
inline |
Construct a FHMQV domain.
T1 | template parameter used as a constructor parameter |
T2 | template parameter used as a constructor parameter |
T3 | template parameter used as a constructor parameter |
T4 | template parameter used as a constructor parameter |
v1 | first parameter |
v2 | second parameter |
v3 | third parameter |
v4 | third parameter |
clientRole | flag indicating initiator or recipient |
v1, v2, v3 and v4 are passed directly to the GROUP_PARAMETERS object.
clientRole = true
indicates initiator, and clientRole = false
indicates recipient or server.
|
inline |
|
inline |
|
inlinevirtual |
Retrieves the crypto parameters for this domain.
Implements KeyAgreementAlgorithm.
|
inlinevirtual |
Provides the size of the agreed value.
The length is calculated using GetEncodedElementSize(false)
, which means the element is encoded in a non-reversible format. A non-reversible format means its a raw byte array, and it lacks presentation format like an ASN.1 BIT_STRING or OCTET_STRING.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static private key.
The length is calculated using the byte count of the subgroup order.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static public key.
The length is calculated using GetEncodedElementSize(true)
, which means the element is encoded in a reversible format. A reversible format means it has a presentation format, and its an ANS.1 encoded element or point.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate static private key in this domain.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
The private key is a random scalar used as an exponent in the range [1,MaxExponent()]
.
COUNTOF(privateKey) == PrivateStaticKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate a static 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 |
The public key is an element or point on the curve, and its stored in a revrsible format. A reversible format means it has a presentation format, and its an ANS.1 encoded element or point.
COUNTOF(publicKey) == PublicStaticKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the ephemeral private key.
An ephemeral private key is a private key and public key. The serialized size is different than a static private key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the ephemeral public key.
An ephemeral public key is a public key. The serialized size is the same as a static public key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate ephemeral private key in this domain.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
COUNTOF(privateKey) == EphemeralPrivateKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate ephemeral 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) == EphemeralPublicKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Derive agreed value or shared secret.
agreedValue | the shared secret |
staticPrivateKey | your long term private key |
ephemeralPrivateKey | your ephemeral private key |
staticOtherPublicKey | couterparty's long term public key |
ephemeralOtherPublicKey | couterparty's ephemeral public key |
validateStaticOtherPublicKey | flag indicating validation |
Agree() performs the authenticated key agreement. Agree() derives a shared secret from your private keys and couterparty's public keys. Each instance or run of the protocol should use a new ephemeral key pair.
The other's ephemeral public key will always be validated at Level 1 to ensure it is a point on the curve. validateStaticOtherPublicKey
determines how thoroughly other's static public key is validated. If you have previously validated the couterparty's static public key, then use validateStaticOtherPublicKey=false
to save time.
COUNTOF(agreedValue) == AgreedValueLength()
COUNTOF(staticPrivateKey) == StaticPrivateKeyLength()
COUNTOF(ephemeralPrivateKey) == EphemeralPrivateKeyLength()
COUNTOF(staticOtherPublicKey) == StaticPublicKeyLength()
COUNTOF(ephemeralOtherPublicKey) == EphemeralPublicKeyLength()
Implements AuthenticatedKeyAgreementDomain.