Crypto++  8.5
Free C++ class library of cryptographic schemes
Public Types | Public Member Functions | List of all members
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION > Class Template Reference

MQV domain for performing authenticated key agreement. More...

+ Inheritance diagram for MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >:

Public Types

typedef GROUP_PARAMETERS GroupParameters
 
typedef GroupParameters::Element Element
 
typedef MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION > Domain
 

Public Member Functions

 MQV_Domain ()
 Construct a MQV domain.
 
 MQV_Domain (const GroupParameters &params)
 Construct a MQV domain. More...
 
 MQV_Domain (BufferedTransformation &bt)
 Construct a MQV domain. More...
 
template<class T1 , class T2 >
 MQV_Domain (T1 v1, T2 v2)
 Construct a MQV domain. More...
 
template<class T1 , class T2 , class T3 >
 MQV_Domain (T1 v1, T2 v2, T3 v3)
 Construct a MQV domain. More...
 
template<class T1 , class T2 , class T3 , class T4 >
 MQV_Domain (T1 v1, T2 v2, T3 v3, T4 v4)
 Construct a MQV domain. More...
 
const GroupParameters & GetGroupParameters () const
 Retrieves the group parameters for this domain. More...
 
GroupParameters & AccessGroupParameters ()
 Retrieves the group parameters for this domain. More...
 
CryptoParametersAccessCryptoParameters ()
 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 void GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
 Generate a static private/public key pair. More...
 
virtual void GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const
 Generate private/public key pair. More...
 
- Public Member Functions inherited from KeyAgreementAlgorithm
CryptoMaterialAccessMaterial ()
 Retrieves a reference to Crypto Parameters. More...
 
const CryptoMaterialGetMaterial () const
 Retrieves a reference to Crypto Parameters. More...
 
virtual const CryptoParametersGetCryptoParameters () const
 Retrieves a reference to Crypto Parameters. 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 ClonableClone () const
 Copies this object. More...
 

Detailed Description

template<class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
class MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >

MQV domain for performing authenticated key agreement.

Template Parameters
GROUP_PARAMETERSdoamin parameters
COFACTOR_OPTIONcofactor option

GROUP_PARAMETERS parameters include the curve coefcients and the base point. Binary curves use a polynomial to represent its characteristic, while prime curves use a prime number.

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

Definition at line 28 of file mqv.h.

Constructor & Destructor Documentation

◆ MQV_Domain() [1/5]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::MQV_Domain ( const GroupParameters &  params)
inline

Construct a MQV domain.

Parameters
paramsgroup parameters and options

Definition at line 40 of file mqv.h.

◆ MQV_Domain() [2/5]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::MQV_Domain ( BufferedTransformation bt)
inline

Construct a MQV domain.

Parameters
btBufferedTransformation with group parameters and options

Definition at line 45 of file mqv.h.

◆ MQV_Domain() [3/5]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
template<class T1 , class T2 >
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::MQV_Domain ( T1  v1,
T2  v2 
)
inline

Construct a MQV domain.

Template Parameters
T1template parameter used as a constructor parameter
T2template parameter used as a constructor parameter
Parameters
v1first parameter
v2second parameter

v1 and v2 are passed directly to the GROUP_PARAMETERS object.

Definition at line 55 of file mqv.h.

◆ MQV_Domain() [4/5]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
template<class T1 , class T2 , class T3 >
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::MQV_Domain ( T1  v1,
T2  v2,
T3  v3 
)
inline

Construct a MQV 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

v1, v2 and v3 are passed directly to the GROUP_PARAMETERS object.

Definition at line 67 of file mqv.h.

◆ MQV_Domain() [5/5]

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
template<class T1 , class T2 , class T3 , class T4 >
MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::MQV_Domain ( T1  v1,
T2  v2,
T3  v3,
T4  v4 
)
inline

Construct a MQV 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

v1, v2, v3 and v4 are passed directly to the GROUP_PARAMETERS object.

Definition at line 81 of file mqv.h.

Member Function Documentation

◆ GetGroupParameters()

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

Retrieves the group parameters for this domain.

Returns
the group parameters for this domain as a const reference

Definition at line 86 of file mqv.h.

◆ AccessGroupParameters()

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

Retrieves the group parameters for this domain.

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

Definition at line 90 of file mqv.h.

◆ AccessCryptoParameters()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
CryptoParameters& MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 94 of file mqv.h.

◆ AgreedValueLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
unsigned int MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 102 of file mqv.h.

◆ StaticPrivateKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
unsigned int MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 107 of file mqv.h.

◆ StaticPublicKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
unsigned int MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 115 of file mqv.h.

◆ GenerateStaticPrivateKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
void MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 123 of file mqv.h.

◆ GenerateStaticPublicKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
void MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 137 of file mqv.h.

◆ EphemeralPrivateKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
unsigned int MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 150 of file mqv.h.

◆ EphemeralPublicKeyLength()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
unsigned int MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 156 of file mqv.h.

◆ GenerateEphemeralPrivateKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
void MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 162 of file mqv.h.

◆ GenerateEphemeralPublicKey()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
void MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 176 of file mqv.h.

◆ Agree()

template<class GROUP_PARAMETERS , class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
bool MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::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 205 of file mqv.h.


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