diff options
author | lloyd <[email protected]> | 2010-03-05 19:45:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-05 19:45:26 +0000 |
commit | 7b4486c601d2726994c489c503917b9a175b6453 (patch) | |
tree | 412b01f48b31ab97b68b1066b8cc12fe0c30e2b3 /src | |
parent | c80b4df255c2dc1e4a2e100e62469e3c0f1d38a8 (diff) |
Set domain_encoding enum in all EC key constructors
Diffstat (limited to 'src')
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index 5ad0fbddd..a4bd9b635 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -35,20 +35,11 @@ EC_PublicKey::EC_PublicKey(const EC_Domain_Params& dom_par, } } -AlgorithmIdentifier EC_PublicKey::algorithm_identifier() const - { - return AlgorithmIdentifier(get_oid(), DER_domain()); - } - -MemoryVector<byte> EC_PublicKey::x509_subject_public_key() const - { - return EC2OSP(public_point(), PointGFp::COMPRESSED); - } - EC_PublicKey::EC_PublicKey(const AlgorithmIdentifier& alg_id, const MemoryRegion<byte>& key_bits) { domain_params = EC_Domain_Params(alg_id.parameters); + domain_encoding = EC_DOMPAR_ENC_EXPLICIT; public_key = PointGFp(OS2ECP(key_bits, domain().get_curve())); @@ -62,6 +53,16 @@ EC_PublicKey::EC_PublicKey(const AlgorithmIdentifier& alg_id, } } +AlgorithmIdentifier EC_PublicKey::algorithm_identifier() const + { + return AlgorithmIdentifier(get_oid(), DER_domain()); + } + +MemoryVector<byte> EC_PublicKey::x509_subject_public_key() const + { + return EC2OSP(public_point(), PointGFp::COMPRESSED); + } + void EC_PublicKey::set_parameter_encoding(EC_Domain_Params_Encoding form) { if(form != EC_DOMPAR_ENC_EXPLICIT && @@ -92,6 +93,8 @@ EC_PrivateKey::EC_PrivateKey(const EC_Domain_Params& dom_par, const BigInt& priv_key) { domain_params = dom_par; + domain_encoding = EC_DOMPAR_ENC_EXPLICIT; + public_key = domain().get_base_point() * priv_key; private_key = priv_key; } @@ -103,6 +106,7 @@ EC_PrivateKey::EC_PrivateKey(RandomNumberGenerator& rng, const EC_Domain_Params& dom_par) { domain_params = dom_par; + domain_encoding = EC_DOMPAR_ENC_EXPLICIT; private_key = BigInt::random_integer(rng, 1, domain().get_order()); public_key = domain().get_base_point() * private_key; @@ -132,6 +136,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id, const MemoryRegion<byte>& key_bits) { domain_params = EC_Domain_Params(alg_id.parameters); + domain_encoding = EC_DOMPAR_ENC_EXPLICIT; u32bit version; SecureVector<byte> octstr_secret; |