#include <xtrcrypt.h>
Inheritance diagram for XTR_DH:
Definition at line 14 of file xtrcrypt.h.
Public Member Functions | |
XTR_DH (const Integer &p, const Integer &q, const GFP2Element &g) | |
XTR_DH (RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits) | |
XTR_DH (BufferedTransformation &domainParams) | |
void | DEREncode (BufferedTransformation &domainParams) const |
for backwards compatibility, calls GetMaterial().Save(bt) | |
bool | Validate (RandomNumberGenerator &rng, unsigned int level) const |
check this object for errors | |
bool | GetVoidValue (const char *name, const std::type_info &valueType, void *pValue) const |
to be implemented by derived classes, users should use one of the above functions instead | |
void | AssignFrom (const NameValuePairs &source) |
assign values from source to this object | |
CryptoParameters & | AccessCryptoParameters () |
unsigned int | AgreedValueLength () const |
return length of agreed value produced | |
unsigned int | PrivateKeyLength () const |
return length of private keys in this domain | |
unsigned int | PublicKeyLength () const |
return length of public keys in this domain | |
void | GeneratePrivateKey (RandomNumberGenerator &rng, byte *privateKey) const |
generate private key | |
void | GeneratePublicKey (RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const |
generate public key | |
bool | Agree (byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const |
derive agreed value from your private key and couterparty's public key, return false in case of failure | |
const Integer & | GetModulus () const |
const Integer & | GetSubgroupOrder () const |
const GFP2Element & | GetSubgroupGenerator () const |
void | SetModulus (const Integer &p) |
void | SetSubgroupOrder (const Integer &q) |
void | SetSubgroupGenerator (const GFP2Element &g) |
virtual void | GenerateKeyPair (RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const |
generate private/public key pair | |
CryptoMaterial & | AccessMaterial () |
returns a reference to the crypto material used by this object | |
const CryptoMaterial & | GetMaterial () const |
returns a const reference to the crypto material used by this object | |
virtual const CryptoParameters & | GetCryptoParameters () const |
void | BERDecode (BufferedTransformation &bt) |
for backwards compatibility, calls AccessMaterial().Load(bt) | |
virtual std::string | AlgorithmName () const |
returns name of this algorithm, not universally implemented yet | |
virtual Clonable * | Clone () const |
this is not implemented by most classes yet |
bool XTR_DH::Validate | ( | RandomNumberGenerator & | rng, | |
unsigned int | level | |||
) | const [virtual] |
check this object for errors
level | denotes the level of thoroughness: 0 - using this object won't cause a crash or exception (rng is ignored) 1 - this object will probably function (encrypt, sign, etc.) correctly (but may not check for weak keys and such) 2 - make sure this object will function correctly, and do reasonable security checks 3 - do checks that may take a long time |
Implements CryptoMaterial.
Definition at line 41 of file xtrcrypt.cpp.
References GFP2Element::c1, GFP2Element::c2, Integer::IsNegative(), Integer::IsOdd(), Integer::One(), and Integer::Squared().
void XTR_DH::AssignFrom | ( | const NameValuePairs & | source | ) | [virtual] |
assign values from source to this object
Implements CryptoMaterial.
Definition at line 68 of file xtrcrypt.cpp.
void XTR_DH::GeneratePrivateKey | ( | RandomNumberGenerator & | rng, | |
byte * | privateKey | |||
) | const [virtual] |
generate private key
Implements SimpleKeyAgreementDomain.
Definition at line 77 of file xtrcrypt.cpp.
References Integer::Encode(), PrivateKeyLength(), and Integer::Zero().
void XTR_DH::GeneratePublicKey | ( | RandomNumberGenerator & | rng, | |
const byte * | privateKey, | |||
byte * | publicKey | |||
) | const [virtual] |
generate public key
Implements SimpleKeyAgreementDomain.
Definition at line 83 of file xtrcrypt.cpp.
References GFP2Element::Encode(), PrivateKeyLength(), and PublicKeyLength().
bool XTR_DH::Agree | ( | byte * | agreedValue, | |
const byte * | privateKey, | |||
const byte * | otherPublicKey, | |||
bool | validateOtherPublicKey = true | |||
) | const [virtual] |
derive agreed value from your private key and couterparty's public key, return false in case of failure
length of privateKey == PrivateKeyLength()
length of otherPublicKey == PublicKeyLength()
Implements SimpleKeyAgreementDomain.
Definition at line 90 of file xtrcrypt.cpp.
References AgreedValueLength(), GFP2Element::c1, GFP2Element::c2, GFP2_ONB< F >::ConvertIn(), GFP2Element::Encode(), Integer::IsNegative(), PrivateKeyLength(), and PublicKeyLength().
void SimpleKeyAgreementDomain::GenerateKeyPair | ( | RandomNumberGenerator & | rng, | |
byte * | privateKey, | |||
byte * | publicKey | |||
) | const [virtual, inherited] |
generate private/public key pair
Definition at line 675 of file cryptlib.cpp.
References SimpleKeyAgreementDomain::GeneratePrivateKey(), and SimpleKeyAgreementDomain::GeneratePublicKey().