diff options
author | lloyd <[email protected]> | 2010-03-04 02:07:14 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-04 02:07:14 +0000 |
commit | c58d02b152b11bae78985aa441560f49ef6b5d09 (patch) | |
tree | c01bbbbe6ee86f60faf238a271c28dd03326ac5c /src/pubkey/ecc_key/ecc_key.cpp | |
parent | f109029f5f1cc33512091e228e6ee6532058c42f (diff) |
Add a new function to public key x509_subject_public_key which returns
what x509_encoder()->key_bits() used to return. This is much simpler
than using the explicit encoder objects. Remove X509_Encoder entirely.
Diffstat (limited to 'src/pubkey/ecc_key/ecc_key.cpp')
-rw-r--r-- | src/pubkey/ecc_key/ecc_key.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp index 4a0b20d2f..f91f394dc 100644 --- a/src/pubkey/ecc_key/ecc_key.cpp +++ b/src/pubkey/ecc_key/ecc_key.cpp @@ -40,6 +40,11 @@ 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::X509_load_hook() { try @@ -52,29 +57,6 @@ void EC_PublicKey::X509_load_hook() } } -X509_Encoder* EC_PublicKey::x509_encoder() const - { - class EC_Key_Encoder : public X509_Encoder - { - public: - AlgorithmIdentifier alg_id() const - { - return key->algorithm_identifier(); - } - - MemoryVector<byte> key_bits() const - { - return EC2OSP(key->public_point(), PointGFp::COMPRESSED); - } - - EC_Key_Encoder(const EC_PublicKey* k): key(k) {} - private: - const EC_PublicKey* key; - }; - - return new EC_Key_Encoder(this); - } - X509_Decoder* EC_PublicKey::x509_decoder() { class EC_Key_Decoder : public X509_Decoder |