Security Scol plugin
Public Types | Public Member Functions | Protected Member Functions | List of all members
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH > Class Template Reference

Fully Hashed Menezes-Qu-Vanstone in GF(p) More...

#include <fhmqv.h>

Inheritance diagram for FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >:
AuthenticatedKeyAgreementDomain KeyAgreementAlgorithm AsymmetricAlgorithm Algorithm Clonable

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.
 
 FHMQV_Domain (const GroupParameters &params, bool clientRole=true)
 Construct a FHMQV domain.
 
 FHMQV_Domain (BufferedTransformation &bt, bool clientRole=true)
 Construct a FHMQV domain.
 
template<class T1 >
 FHMQV_Domain (T1 v1, bool clientRole=true)
 Construct a FHMQV domain.
 
template<class T1 , class T2 >
 FHMQV_Domain (T1 v1, T2 v2, bool clientRole=true)
 Construct a FHMQV domain.
 
template<class T1 , class T2 , class T3 >
 FHMQV_Domain (T1 v1, T2 v2, T3 v3, bool clientRole=true)
 Construct a FHMQV domain.
 
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.
 
const GroupParameters & GetGroupParameters () const
 Retrieves the group parameters for this domain.
 
GroupParameters & AccessGroupParameters ()
 Retrieves the group parameters for this domain.
 
CryptoParametersAccessCryptoParameters ()
 Retrieves the crypto parameters for this domain.
 
unsigned int AgreedValueLength () const
 Provides the size of the agreed value.
 
unsigned int StaticPrivateKeyLength () const
 Provides the size of the static private key.
 
unsigned int StaticPublicKeyLength () const
 Provides the size of the static public key.
 
void GenerateStaticPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const
 Generate static private key in this domain.
 
void GenerateStaticPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
 Generate a static public key from a private key in this domain.
 
unsigned int EphemeralPrivateKeyLength () const
 Provides the size of the ephemeral private key.
 
unsigned int EphemeralPublicKeyLength () const
 Provides the size of the ephemeral public key.
 
void GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const
 Generate ephemeral private key in this domain.
 
void GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const
 Generate ephemeral public key from a private key in this domain.
 
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.
 
- Public Member Functions inherited from AuthenticatedKeyAgreementDomain
virtual void GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
 Generate a static private/public key pair.
 
virtual void GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
 Generate private/public key pair.
 
- Public Member Functions inherited from KeyAgreementAlgorithm
CryptoMaterialAccessMaterial ()
 Retrieves a reference to Crypto Parameters.
 
const CryptoMaterialGetMaterial () const
 Retrieves a reference to Crypto Parameters.
 
virtual const CryptoParametersGetCryptoParameters () const
 Retrieves a reference to Crypto Parameters.
 
- Public Member Functions inherited from Algorithm
 Algorithm (bool checkSelfTestStatus=true)
 Interface for all crypto algorithms.
 
virtual std::string AlgorithmName () const
 Provides the name of this algorithm.
 
virtual std::string AlgorithmProvider () const
 Retrieve the provider of this algorithm.
 
- Public Member Functions inherited from Clonable
virtual ClonableClone () const
 Copies this object.
 

Protected Member Functions

void Hash (const Element *sigma, const byte *e1, size_t e1len, const byte *e2, size_t e2len, const byte *s1, size_t s1len, const byte *s2, size_t s2len, byte *digest, size_t dlen) const
 

Detailed Description

template<class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
class FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >

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.

See also
MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain
Since
Crypto++ 5.6.4

Definition at line 24 of file fhmqv.h.

Member Typedef Documentation

◆ Domain

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
typedef FHMQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION, HASH> FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Domain

Definition at line 29 of file fhmqv.h.

◆ Element

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
typedef GroupParameters::Element FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Element

Definition at line 28 of file fhmqv.h.

◆ GroupParameters

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
typedef GROUP_PARAMETERS FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GroupParameters

Definition at line 27 of file fhmqv.h.

Constructor & Destructor Documentation

◆ ~FHMQV_Domain()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
virtual FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::~FHMQV_Domain ( )
inlinevirtual

Definition at line 31 of file fhmqv.h.

◆ FHMQV_Domain() [1/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( bool  clientRole = true)
inline

Construct a FHMQV domain.

Parameters
clientRoleflag indicating initiator or recipient

clientRole = true indicates initiator, and clientRole = false indicates recipient or server.

Definition at line 37 of file fhmqv.h.

◆ FHMQV_Domain() [2/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( const GroupParameters &  params,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Parameters
paramsgroup parameters and options
clientRoleflag indicating initiator or recipient

clientRole = true indicates initiator, and clientRole = false indicates recipient or server.

Definition at line 45 of file fhmqv.h.

◆ FHMQV_Domain() [3/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( BufferedTransformation bt,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Parameters
btBufferedTransformation with group parameters and options
clientRoleflag indicating initiator or recipient

clientRole = true indicates initiator, and clientRole = false indicates recipient or server.

Definition at line 53 of file fhmqv.h.

◆ FHMQV_Domain() [4/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template<class T1 >
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( T1  v1,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Template Parameters
T1template parameter used as a constructor parameter
Parameters
v1first parameter
clientRoleflag indicating initiator or recipient

v1 is passed directly to the GROUP_PARAMETERS object.

clientRole = true indicates initiator, and clientRole = false indicates recipient or server.

Definition at line 65 of file fhmqv.h.

◆ FHMQV_Domain() [5/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template<class T1 , class T2 >
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( T1  v1,
T2  v2,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Template Parameters
T1template parameter used as a constructor parameter
T2template parameter used as a constructor parameter
Parameters
v1first parameter
v2second parameter
clientRoleflag 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.

Definition at line 79 of file fhmqv.h.

◆ FHMQV_Domain() [6/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template<class T1 , class T2 , class T3 >
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( T1  v1,
T2  v2,
T3  v3,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Template Parameters
T1template parameter used as a constructor parameter
T2template parameter used as a constructor parameter
T3template parameter used as a constructor parameter
Parameters
v1first parameter
v2second parameter
v3third parameter
clientRoleflag 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.

Definition at line 95 of file fhmqv.h.

◆ FHMQV_Domain() [7/7]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template<class T1 , class T2 , class T3 , class T4 >
FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::FHMQV_Domain ( T1  v1,
T2  v2,
T3  v3,
T4  v4,
bool  clientRole = true 
)
inline

Construct a FHMQV domain.

Template Parameters
T1template parameter used as a constructor parameter
T2template parameter used as a constructor parameter
T3template parameter used as a constructor parameter
T4template parameter used as a constructor parameter
Parameters
v1first parameter
v2second parameter
v3third parameter
v4third parameter
clientRoleflag 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.

Definition at line 113 of file fhmqv.h.

Member Function Documentation

◆ AccessCryptoParameters()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
CryptoParameters & FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::AccessCryptoParameters ( )
inlinevirtual

Retrieves the crypto parameters for this domain.

Returns
the crypto parameters for this domain as a non-const reference

Implements KeyAgreementAlgorithm.

Definition at line 129 of file fhmqv.h.

◆ AccessGroupParameters()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
GroupParameters & FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::AccessGroupParameters ( )
inline

Retrieves the group parameters for this domain.

Returns
the group parameters for this domain as a non-const reference

Definition at line 125 of file fhmqv.h.

◆ Agree()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
bool FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Agree ( byte agreedValue,
const byte staticPrivateKey,
const byte ephemeralPrivateKey,
const byte staticOtherPublicKey,
const byte ephemeralOtherPublicKey,
bool  validateStaticOtherPublicKey = true 
) const
inlinevirtual

Derive agreed value or shared secret.

Parameters
agreedValuethe shared secret
staticPrivateKeyyour long term private key
ephemeralPrivateKeyyour ephemeral private key
staticOtherPublicKeycouterparty's long term public key
ephemeralOtherPublicKeycouterparty's ephemeral public key
validateStaticOtherPublicKeyflag indicating validation
Returns
true upon success, false in case of failure

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.

Precondition
COUNTOF(agreedValue) == AgreedValueLength()
COUNTOF(staticPrivateKey) == StaticPrivateKeyLength()
COUNTOF(ephemeralPrivateKey) == EphemeralPrivateKeyLength()
COUNTOF(staticOtherPublicKey) == StaticPublicKeyLength()
COUNTOF(ephemeralOtherPublicKey) == EphemeralPublicKeyLength()

Implements AuthenticatedKeyAgreementDomain.

Definition at line 243 of file fhmqv.h.

◆ AgreedValueLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
unsigned int FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::AgreedValueLength ( ) const
inlinevirtual

Provides the size of the agreed value.

Returns
size of agreed value produced in this domain

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.

Definition at line 137 of file fhmqv.h.

◆ EphemeralPrivateKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
unsigned int FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::EphemeralPrivateKeyLength ( ) const
inlinevirtual

Provides the size of the ephemeral private key.

Returns
size of ephemeral private keys in this domain

An ephemeral private key is a private key and public key. The serialized size is different than a static private key.

Implements AuthenticatedKeyAgreementDomain.

Definition at line 188 of file fhmqv.h.

◆ EphemeralPublicKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
unsigned int FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::EphemeralPublicKeyLength ( ) const
inlinevirtual

Provides the size of the ephemeral public key.

Returns
size of ephemeral public keys in this domain

An ephemeral public key is a public key. The serialized size is the same as a static public key.

Implements AuthenticatedKeyAgreementDomain.

Definition at line 194 of file fhmqv.h.

◆ GenerateEphemeralPrivateKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
void FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GenerateEphemeralPrivateKey ( RandomNumberGenerator rng,
byte privateKey 
) const
inlinevirtual

Generate ephemeral private key in this domain.

Parameters
rnga RandomNumberGenerator derived class
privateKeya byte buffer for the generated private key in this domain
Precondition
COUNTOF(privateKey) == EphemeralPrivateKeyLength()

Implements AuthenticatedKeyAgreementDomain.

Definition at line 200 of file fhmqv.h.

◆ GenerateEphemeralPublicKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
void FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GenerateEphemeralPublicKey ( RandomNumberGenerator rng,
const byte privateKey,
byte publicKey 
) const
inlinevirtual

Generate ephemeral public key from a private key in this domain.

Parameters
rnga RandomNumberGenerator derived class
privateKeya byte buffer with the previously generated private key
publicKeya byte buffer for the generated public key in this domain
Precondition
COUNTOF(publicKey) == EphemeralPublicKeyLength()

Implements AuthenticatedKeyAgreementDomain.

Definition at line 214 of file fhmqv.h.

◆ GenerateStaticPrivateKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
void FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GenerateStaticPrivateKey ( RandomNumberGenerator rng,
byte privateKey 
) const
inlinevirtual

Generate static private key in this domain.

Parameters
rnga RandomNumberGenerator derived class
privateKeya 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()].

Precondition
COUNTOF(privateKey) == PrivateStaticKeyLength()

Implements AuthenticatedKeyAgreementDomain.

Definition at line 161 of file fhmqv.h.

◆ GenerateStaticPublicKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
void FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GenerateStaticPublicKey ( RandomNumberGenerator rng,
const byte privateKey,
byte publicKey 
) const
inlinevirtual

Generate a static public key from a private key in this domain.

Parameters
rnga RandomNumberGenerator derived class
privateKeya byte buffer with the previously generated private key
publicKeya 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.

Precondition
COUNTOF(publicKey) == PublicStaticKeyLength()

Implements AuthenticatedKeyAgreementDomain.

Definition at line 175 of file fhmqv.h.

◆ GetGroupParameters()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
const GroupParameters & FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::GetGroupParameters ( ) const
inline

Retrieves the group parameters for this domain.

Returns
the group parameters for this domain as a const reference

Definition at line 121 of file fhmqv.h.

◆ Hash()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
void FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::Hash ( const Element *  sigma,
const byte e1,
size_t  e1len,
const byte e2,
size_t  e2len,
const byte s1,
size_t  s1len,
const byte s2,
size_t  s2len,
byte digest,
size_t  dlen 
) const
inlineprotected

Definition at line 346 of file fhmqv.h.

◆ StaticPrivateKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
unsigned int FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::StaticPrivateKeyLength ( ) const
inlinevirtual

Provides the size of the static private key.

Returns
size of static private keys in this domain

The length is calculated using the byte count of the subgroup order.

Implements AuthenticatedKeyAgreementDomain.

Definition at line 143 of file fhmqv.h.

◆ StaticPublicKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
unsigned int FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >::StaticPublicKeyLength ( ) const
inlinevirtual

Provides the size of the static public key.

Returns
size of static public keys in this domain

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.

Definition at line 152 of file fhmqv.h.


The documentation for this class was generated from the following file: