Security Scol plugin
|
Unified Diffie-Hellman in GF(p) More...
#include <dh2.h>
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. | |
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. | |
void | GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate a static private/public key pair. | |
unsigned int | EphemeralPrivateKeyLength () const |
Provides the size of ephemeral private key. | |
unsigned int | EphemeralPublicKeyLength () const |
Provides the size of ephemeral public key. | |
void | GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
Generate ephemeral private key. | |
void | GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
Generate ephemeral public key. | |
void | GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate private/public key pair. | |
bool | Agree (byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const |
Derive agreed value. | |
Public Member Functions inherited from KeyAgreementAlgorithm | |
CryptoMaterial & | AccessMaterial () |
Retrieves a reference to Crypto Parameters. | |
const CryptoMaterial & | GetMaterial () const |
Retrieves a reference to Crypto Parameters. | |
virtual const CryptoParameters & | GetCryptoParameters () 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 Clonable * | Clone () const |
Copies this object. | |
Protected Attributes | |
SimpleKeyAgreementDomain & | d1 |
SimpleKeyAgreementDomain & | d2 |
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.
|
inline |
|
inline |
|
inlinevirtual |
Retrieves a reference to Crypto Parameters.
Implements KeyAgreementAlgorithm.
|
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 |
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.
COUNTOF(agreedValue) == AgreedValueLength()
COUNTOF(staticPrivateKey) == StaticPrivateKeyLength()
COUNTOF(ephemeralPrivateKey) == EphemeralPrivateKeyLength()
COUNTOF(staticOtherPublicKey) == StaticPublicKeyLength()
COUNTOF(ephemeralOtherPublicKey) == EphemeralPublicKeyLength()
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the agreed value.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of ephemeral private key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of ephemeral public key.
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.
|
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 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 |
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 |
Provides the size of the static private key.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static public key.
Implements AuthenticatedKeyAgreementDomain.
|
protected |
|
protected |