Crypto++ 8.2
Free C&
|
MQV domain for performing authenticated key agreement. More...
#include <mqv.h>
Public Types | |
typedef GROUP_PARAMETERS | GroupParameters |
typedef GroupParameters::Element | Element |
typedef MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION > | Domain |
Public Member Functions | |
MQV_Domain () | |
Construct a MQV domain. | |
MQV_Domain (const GroupParameters ¶ms) | |
Construct a MQV domain. | |
MQV_Domain (BufferedTransformation &bt) | |
Construct a MQV domain. | |
template<class T1 , class T2 > | |
MQV_Domain (T1 v1, T2 v2) | |
Construct a MQV domain. | |
template<class T1 , class T2 , class T3 > | |
MQV_Domain (T1 v1, T2 v2, T3 v3) | |
Construct a MQV domain. | |
template<class T1 , class T2 , class T3 , class T4 > | |
MQV_Domain (T1 v1, T2 v2, T3 v3, T4 v4) | |
Construct a MQV domain. | |
const GroupParameters & | GetGroupParameters () const |
Retrieves the group parameters for this domain. | |
GroupParameters & | AccessGroupParameters () |
Retrieves the group parameters for this domain. | |
CryptoParameters & | AccessCryptoParameters () |
Retrieves the crypto parameters for this domain. | |
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. | |
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. | |
bool | Agree (byte *agreedValue, const byte *staticPrivateKey, const byte *ephemeralPrivateKey, const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey, bool validateStaticOtherPublicKey=true) const |
Derive agreed value. | |
![]() | |
virtual unsigned int | AgreedValueLength () const =0 |
Provides the size of the agreed value. | |
virtual unsigned int | StaticPrivateKeyLength () const =0 |
Provides the size of the static private key. | |
virtual unsigned int | StaticPublicKeyLength () const =0 |
Provides the size of the static public key. | |
virtual void | GenerateStaticPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const =0 |
Generate static private key in this domain. | |
virtual void | GenerateStaticPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0 |
Generate a static public key from a private key in this domain. | |
virtual void | GenerateStaticKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate a static private/public key pair. | |
virtual unsigned int | EphemeralPrivateKeyLength () const =0 |
Provides the size of ephemeral private key. | |
virtual unsigned int | EphemeralPublicKeyLength () const =0 |
Provides the size of ephemeral public key. | |
virtual void | GenerateEphemeralPrivateKey (RandomNumberGenerator &rng, byte *privateKey) const =0 |
Generate ephemeral private key. | |
virtual void | GenerateEphemeralPublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const =0 |
Generate ephemeral public key. | |
virtual void | GenerateEphemeralKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
Generate private/public key pair. | |
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. | |
![]() | |
CryptoMaterial & | AccessMaterial () |
Retrieves a reference to Crypto Parameters. | |
const CryptoMaterial & | GetMaterial () const |
Retrieves a reference to Crypto Parameters. | |
virtual CryptoParameters & | AccessCryptoParameters ()=0 |
Retrieves a reference to Crypto Parameters. | |
virtual const CryptoParameters & | GetCryptoParameters () const |
Retrieves a reference to Crypto Parameters. | |
virtual CryptoMaterial & | AccessMaterial ()=0 |
Retrieves a reference to CryptoMaterial. | |
virtual const CryptoMaterial & | GetMaterial () const =0 |
Retrieves a reference to CryptoMaterial. | |
![]() | |
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. | |
![]() | |
virtual Clonable * | Clone () const |
Copies this object. | |
MQV domain for performing authenticated key agreement.
GROUP_PARAMETERS | doamin parameters |
COFACTOR_OPTION | cofactor option |
GROUP_PARAMETERS parameters include the curve coefcients and the base point. Binary curves use a polynomial to represent its characteristic, while prime curves use a prime number.
typedef GROUP_PARAMETERS MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::GroupParameters |
typedef GroupParameters::Element MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::Element |
typedef MQV_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> MQV_Domain< GROUP_PARAMETERS, COFACTOR_OPTION >::Domain |
|
inline |
|
inline |
|
inline |
Construct a MQV domain.
bt | BufferedTransformation with group parameters and options |
|
inline |
|
inline |
Construct a MQV domain.
T1 | template parameter used as a constructor parameter |
T2 | template parameter used as a constructor parameter |
T3 | template parameter used as a constructor parameter |
v1 | first parameter |
v2 | second parameter |
v3 | third parameter |
v1, v2 and v3 are passed directly to the GROUP_PARAMETERS object.
|
inline |
Construct a MQV domain.
T1 | template parameter used as a constructor parameter |
T2 | template parameter used as a constructor parameter |
T3 | template parameter used as a constructor parameter |
T4 | template parameter used as a constructor parameter |
v1 | first parameter |
v2 | second parameter |
v3 | third parameter |
v4 | third parameter |
v1, v2, v3 and v4 are passed directly to the GROUP_PARAMETERS object.
|
inline |
|
inline |
|
inlinevirtual |
Retrieves the crypto parameters for this domain.
Implements KeyAgreementAlgorithm.
|
inlinevirtual |
Provides the size of the agreed value.
The length is calculated using GetEncodedElementSize(false)
, which means the element is encoded in a non-reversible format. A non-reversible format means its a raw byte array, and it lacks presentation format like an ASN.1 BIT_STRING or OCTET_STRING.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static private key.
The length is calculated using the byte count of the subgroup order.
Implements AuthenticatedKeyAgreementDomain.
|
inlinevirtual |
Provides the size of the static public key.
The length is calculated using GetEncodedElementSize(true)
, which means the element is encoded in a reversible format. A reversible format means it has a presentation format, and its an ANS.1 encoded element or point.
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 |
The private key is a random scalar used as an exponent in the range [1,MaxExponent()]
.
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 |
The public key is an element or point on the curve, and its stored in a revrsible format. A reversible format means it has a presentation format, and its an ANS.1 encoded element or point.
COUNTOF(publicKey) == PublicStaticKeyLength()
Implements 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 |
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.