diff options
author | lloyd <[email protected]> | 2010-03-02 04:01:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-02 04:01:18 +0000 |
commit | b822cc605b324bf449fb3e0a2185b83cd4a157e3 (patch) | |
tree | f59b57f65e30a0c025c0c4265e591a9f507ac0ff /src/pubkey/gost_3410 | |
parent | 510128ffd3789301305c7f1fe52a11b238a6a60b (diff) |
Add some simple constructors to the EC_ base key types to simplify
the various implementations
Diffstat (limited to 'src/pubkey/gost_3410')
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.cpp | 25 | ||||
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.h | 8 |
2 files changed, 5 insertions, 28 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 1c3faca7a..8dd72dfc1 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -16,31 +16,6 @@ namespace Botan { -GOST_3410_PrivateKey::GOST_3410_PrivateKey(RandomNumberGenerator& rng, - const EC_Domain_Params& dom_pars) - { - domain_params = dom_pars; - generate_private_key(rng); - } - -GOST_3410_PrivateKey::GOST_3410_PrivateKey(const EC_Domain_Params& dom_pars, - const BigInt& x) - { - domain_params = dom_pars; - - private_key = x; - public_key = domain().get_base_point() * private_key; - - try - { - public_key.check_invariants(); - } - catch(Illegal_Point) - { - throw Invalid_State("GOST_3410 key generation failed"); - } - } - X509_Encoder* GOST_3410_PublicKey::x509_encoder() const { class GOST_3410_Key_Encoder : public X509_Encoder diff --git a/src/pubkey/gost_3410/gost_3410.h b/src/pubkey/gost_3410/gost_3410.h index 1d3430753..8104cbb75 100644 --- a/src/pubkey/gost_3410/gost_3410.h +++ b/src/pubkey/gost_3410/gost_3410.h @@ -63,7 +63,7 @@ class BOTAN_DLL GOST_3410_PublicKey : public virtual EC_PublicKey, * @param public_point the public point defining this key */ GOST_3410_PublicKey(const EC_Domain_Params& dom_par, - const PointGFp& public_point); // sets core + const PointGFp& public_point); /** * Get an x509_encoder that can be used to encode this key. @@ -98,14 +98,16 @@ class BOTAN_DLL GOST_3410_PrivateKey : public GOST_3410_PublicKey, * @param the domain parameters to used for this key */ GOST_3410_PrivateKey(RandomNumberGenerator& rng, - const EC_Domain_Params& domain); + const EC_Domain_Params& domain) : + EC_PrivateKey(rng, domain) {} /** * Load a private key * @param domain parameters * @param x the private key */ - GOST_3410_PrivateKey(const EC_Domain_Params& domain, const BigInt& x); + GOST_3410_PrivateKey(const EC_Domain_Params& domain, const BigInt& x) : + EC_PrivateKey(domain, x) {} /** * Sign a message with this key. |