Crypto++
8.3
Free C++ class library of cryptographic schemes
|
Unified Diffie-Hellman in GF(p) More...
Public Member Functions | |
DH2 (SimpleKeyAgreementDomain &domain) | |
Construct a DH2. | |
DH2 (SimpleKeyAgreementDomain &staticDomain, SimpleKeyAgreementDomain &ephemeralDomain) | |
Construct a DH2. | |
CryptoParameters & | AccessCryptoParameters () |
Retrieves a reference to Crypto Parameters. 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... | |
void | GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate a static private/public key pair. More... | |
unsigned int | EphemeralPrivateKeyLength () const |
Provides the size of ephemeral private key. More... | |
unsigned int | EphemeralPublicKeyLength () const |
Provides the size of ephemeral public key. More... | |
void | GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
Generate ephemeral private key. More... | |
void | GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
Generate ephemeral public key. More... | |
void | GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate private/public key pair. More... | |
bool | Agree (byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const |
Derive agreed value. More... | |
![]() | |
CryptoMaterial & | AccessMaterial () |
Retrieves a reference to Crypto Parameters. More... | |
const CryptoMaterial & | GetMaterial () const |
Retrieves a reference to Crypto Parameters. More... | |
virtual const CryptoParameters & | GetCryptoParameters () const |
Retrieves a reference to Crypto Parameters. More... | |
![]() | |
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... | |
![]() | |
virtual Clonable * | Clone () const |
Copies this object. More... | |
Unified Diffie-Hellman in GF(p)
A Diffie-Hellman 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.
|
inlinevirtual |
Retrieves a reference to Crypto Parameters.
Implements KeyAgreementAlgorithm.
|
inlinevirtual |
Provides the size of the agreed value.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static private key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static public key.
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 |
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 |
COUNTOF(publicKey) == PublicStaticKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate a static private/public key pair.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
publicKey | a byte buffer for the generated public key in this domain GenerateStaticKeyPair() is equivalent to calling GenerateStaticPrivateKey() and then GenerateStaticPublicKey(). |
COUNTOF(privateKey) == PrivateStaticKeyLength()
COUNTOF(publicKey) == PublicStaticKeyLength()
Reimplemented from AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of ephemeral private key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of ephemeral public key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate ephemeral private key.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
COUNTOF(privateKey) == PrivateEphemeralKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate ephemeral public key.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
publicKey | a byte buffer for the generated public key in this domain |
COUNTOF(publicKey) == PublicEphemeralKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Generate private/public key pair.
rng | a RandomNumberGenerator derived class |
privateKey | a byte buffer for the generated private key in this domain |
publicKey | a byte buffer for the generated public key in this domain GenerateEphemeralKeyPair() is equivalent to calling GenerateEphemeralPrivateKey() and then GenerateEphemeralPublicKey() |
Reimplemented from AuthenticatedKeyAgreementDomain.
|
virtual |
Derive agreed value.
agreedValue | a byte buffer for the shared secret |
staticPrivateKey | a byte buffer with your static private key in this domain |
ephemeralPrivateKey | a byte buffer with your ephemeral private key in this domain |
staticOtherPublicKey | a byte buffer with the other party's static public key in this domain |
ephemeralOtherPublicKey | a byte buffer with the other party's ephemeral public key in this domain |
validateStaticOtherPublicKey | a flag indicating if the other party's public key should be validated |
validateStaticOtherPublicKey=false
to save time. COUNTOF(agreedValue) == AgreedValueLength()
COUNTOF(staticPrivateKey) == StaticPrivateKeyLength()
COUNTOF(ephemeralPrivateKey) == EphemeralPrivateKeyLength()
COUNTOF(staticOtherPublicKey) == StaticPublicKeyLength()
COUNTOF(ephemeralOtherPublicKey) == EphemeralPublicKeyLength()
Implements AuthenticatedKeyAgreementDomain.