Crypto++ 8.7
Free C++ class library of cryptographic schemes
Public Member Functions | List of all members
AuthenticatedKeyAgreementDomain Class Referenceabstract

Interface for domains of authenticated key agreement protocols. More...

#include <cryptlib.h>

+ Inheritance diagram for AuthenticatedKeyAgreementDomain:

Public Member Functions

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
CryptoMaterialAccessMaterial ()
 Retrieves a reference to Crypto Parameters. More...
 
const CryptoMaterialGetMaterial () const
 Retrieves a reference to Crypto Parameters. More...
 
virtual CryptoParametersAccessCryptoParameters ()=0
 Retrieves a reference to Crypto Parameters. More...
 
virtual const CryptoParametersGetCryptoParameters () const
 Retrieves a reference to Crypto Parameters. More...
 
virtual CryptoMaterialAccessMaterial ()=0
 Retrieves a reference to CryptoMaterial. More...
 
virtual const CryptoMaterialGetMaterial () 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 ClonableClone () const
 Copies this object. More...
 

Detailed Description

Interface for domains of authenticated key agreement protocols.

In an authenticated key agreement protocol, each party has two key pairs. The long-lived key pair is called the static key pair, and the short-lived key pair is called the ephemeral key pair.

Since
Crypto++ 3.0

Definition at line 3071 of file cryptlib.h.

Constructor & Destructor Documentation

◆ ~AuthenticatedKeyAgreementDomain()

virtual AuthenticatedKeyAgreementDomain::~AuthenticatedKeyAgreementDomain ( )
inlinevirtual

Definition at line 3074 of file cryptlib.h.

Member Function Documentation

◆ AgreedValueLength()

virtual unsigned int AuthenticatedKeyAgreementDomain::AgreedValueLength ( ) const
pure virtual

Provides the size of the agreed value.

Returns
size of agreed value produced in this domain

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ StaticPrivateKeyLength()

virtual unsigned int AuthenticatedKeyAgreementDomain::StaticPrivateKeyLength ( ) const
pure virtual

Provides the size of the static private key.

Returns
size of static private keys in this domain

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ StaticPublicKeyLength()

virtual unsigned int AuthenticatedKeyAgreementDomain::StaticPublicKeyLength ( ) const
pure virtual

Provides the size of the static public key.

Returns
size of static public keys in this domain

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateStaticPrivateKey()

virtual void AuthenticatedKeyAgreementDomain::GenerateStaticPrivateKey ( RandomNumberGenerator rng,
byte privateKey 
) const
pure virtual

Generate static private key in this domain.

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

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateStaticPublicKey()

virtual void AuthenticatedKeyAgreementDomain::GenerateStaticPublicKey ( RandomNumberGenerator rng,
const byte privateKey,
byte publicKey 
) const
pure virtual

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
Precondition
COUNTOF(publicKey) == PublicStaticKeyLength()

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateStaticKeyPair()

virtual void AuthenticatedKeyAgreementDomain::GenerateStaticKeyPair ( RandomNumberGenerator rng,
byte privateKey,
byte publicKey 
) const
virtual

Generate a static private/public key pair.

Parameters
rnga RandomNumberGenerator derived class
privateKeya byte buffer for the generated private key in this domain
publicKeya byte buffer for the generated public key in this domain

GenerateStaticKeyPair() is equivalent to calling GenerateStaticPrivateKey() and then GenerateStaticPublicKey().

Precondition
COUNTOF(privateKey) == PrivateStaticKeyLength()
COUNTOF(publicKey) == PublicStaticKeyLength()

Reimplemented in DH2.

◆ EphemeralPrivateKeyLength()

virtual unsigned int AuthenticatedKeyAgreementDomain::EphemeralPrivateKeyLength ( ) const
pure virtual

Provides the size of ephemeral private key.

Returns
the size of ephemeral private key in this domain

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ EphemeralPublicKeyLength()

virtual unsigned int AuthenticatedKeyAgreementDomain::EphemeralPublicKeyLength ( ) const
pure virtual

Provides the size of ephemeral public key.

Returns
the size of ephemeral public key in this domain

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateEphemeralPrivateKey()

virtual void AuthenticatedKeyAgreementDomain::GenerateEphemeralPrivateKey ( RandomNumberGenerator rng,
byte privateKey 
) const
pure virtual

Generate ephemeral private key.

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

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateEphemeralPublicKey()

virtual void AuthenticatedKeyAgreementDomain::GenerateEphemeralPublicKey ( RandomNumberGenerator rng,
const byte privateKey,
byte publicKey 
) const
pure virtual

Generate ephemeral public key.

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

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.

◆ GenerateEphemeralKeyPair()

virtual void AuthenticatedKeyAgreementDomain::GenerateEphemeralKeyPair ( RandomNumberGenerator rng,
byte privateKey,
byte publicKey 
) const
virtual

Generate private/public key pair.

Parameters
rnga RandomNumberGenerator derived class
privateKeya byte buffer for the generated private key in this domain
publicKeya byte buffer for the generated public key in this domain

GenerateEphemeralKeyPair() is equivalent to calling GenerateEphemeralPrivateKey() and then GenerateEphemeralPublicKey()

Reimplemented in DH2.

◆ Agree()

virtual bool AuthenticatedKeyAgreementDomain::Agree ( byte agreedValue,
const byte staticPrivateKey,
const byte ephemeralPrivateKey,
const byte staticOtherPublicKey,
const byte ephemeralOtherPublicKey,
bool  validateStaticOtherPublicKey = true 
) const
pure virtual

Derive agreed value.

Parameters
agreedValuea byte buffer for the shared secret
staticPrivateKeya byte buffer with your static private key in this domain
ephemeralPrivateKeya byte buffer with your ephemeral private key in this domain
staticOtherPublicKeya byte buffer with the other party's static public key in this domain
ephemeralOtherPublicKeya byte buffer with the other party's ephemeral public key in this domain
validateStaticOtherPublicKeya flag indicating if the other party's public key should be validated
Returns
true upon success, false in case of failure

Agree() derives an agreed value from your private keys and couterparty's public keys.

The other party's ephemeral public key is validated by default. If you have previously validated the static public key, use validateStaticOtherPublicKey=false to save time.

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

Implemented in DH2, FHMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, HMQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION, HASH >, and MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >.


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