Fabcoin Core
0.16.2
P2P Digital Currency
|
Unified Diffie-Hellman in GF(p) More...
#include <dh2.h>
Public Member Functions | |
virtual | ~DH2 () |
DH2 (SimpleKeyAgreementDomain &domain) | |
Construct a DH2. More... | |
DH2 (SimpleKeyAgreementDomain &staticDomain, SimpleKeyAgreementDomain &ephemeralDomain) | |
Construct a DH2. More... | |
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... | |
Public Member Functions inherited from AuthenticatedKeyAgreementDomain | |
virtual | ~AuthenticatedKeyAgreementDomain () |
Public Member Functions inherited from KeyAgreementAlgorithm | |
virtual | ~KeyAgreementAlgorithm () |
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... | |
Public Member Functions inherited from AsymmetricAlgorithm | |
virtual | ~AsymmetricAlgorithm () |
void | BERDecode (BufferedTransformation &bt) |
Loads this object from a BufferedTransformation. More... | |
void | DEREncode (BufferedTransformation &bt) const |
Saves this object to a BufferedTransformation. More... | |
Public Member Functions inherited from Algorithm | |
virtual | ~Algorithm () |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. More... | |
virtual std::string | AlgorithmName () const |
Provides the name of this algorithm. More... | |
Public Member Functions inherited from Clonable | |
virtual | ~Clonable () |
virtual Clonable * | Clone () const |
Copies this object. More... | |
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.
Definition at line 15 of file dh2.cpp.
|
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 |