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

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

#include <cryptlib.h>

+ Inheritance diagram for SimpleKeyAgreementDomain:

Public Member Functions

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
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 simple key agreement protocols.

A key agreement domain is a set of parameters that must be shared by two parties in a key agreement protocol, along with the algorithms for generating key pairs and deriving agreed values.

Since
Crypto++ 3.0

Definition at line 3012 of file cryptlib.h.

Constructor & Destructor Documentation

◆ ~SimpleKeyAgreementDomain()

virtual SimpleKeyAgreementDomain::~SimpleKeyAgreementDomain ( )
inlinevirtual

Definition at line 3015 of file cryptlib.h.

Member Function Documentation

◆ AgreedValueLength()

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

Provides the size of the agreed value.

Returns
size of agreed value produced in this domain

Implemented in DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.

◆ PrivateKeyLength()

virtual unsigned int SimpleKeyAgreementDomain::PrivateKeyLength ( ) const
pure virtual

Provides the size of the private key.

Returns
size of private keys in this domain

Implemented in DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.

◆ PublicKeyLength()

virtual unsigned int SimpleKeyAgreementDomain::PublicKeyLength ( ) const
pure virtual

Provides the size of the public key.

Returns
size of public keys in this domain

Implemented in DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.

◆ GeneratePrivateKey()

virtual void SimpleKeyAgreementDomain::GeneratePrivateKey ( RandomNumberGenerator rng,
byte privateKey 
) const
pure virtual

Generate private key in this domain.

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

Implemented in DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.

◆ GeneratePublicKey()

virtual void SimpleKeyAgreementDomain::GeneratePublicKey ( RandomNumberGenerator rng,
const byte privateKey,
byte publicKey 
) const
pure virtual

Generate a 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) == PublicKeyLength()

Implemented in DH_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >, DH_Domain< DL_GroupParameters_GFP_DefaultSafePrime >, DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.

◆ GenerateKeyPair()

virtual void SimpleKeyAgreementDomain::GenerateKeyPair ( RandomNumberGenerator rng,
byte privateKey,
byte publicKey 
) const
virtual

Generate a 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

GenerateKeyPair() is equivalent to calling GeneratePrivateKey() and then GeneratePublicKey().

Precondition
COUNTOF(privateKey) == PrivateKeyLength()
COUNTOF(publicKey) == PublicKeyLength()

◆ Agree()

virtual bool SimpleKeyAgreementDomain::Agree ( byte agreedValue,
const byte privateKey,
const byte otherPublicKey,
bool  validateOtherPublicKey = true 
) const
pure virtual

Derive agreed value.

Parameters
agreedValuea byte buffer for the shared secret
privateKeya byte buffer with your private key in this domain
otherPublicKeya byte buffer with the other party's public key in this domain
validateOtherPublicKeya 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 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(privateKey) == PrivateKeyLength()
COUNTOF(otherPublicKey) == PublicKeyLength()

Implemented in DL_SimpleKeyAgreementDomainBase< T >, DL_SimpleKeyAgreementDomainBase< GROUP_PARAMETERS::Element >, x25519, and XTR_DH.


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