aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/ecc_key
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 02:07:14 +0000
committerlloyd <[email protected]>2010-03-04 02:07:14 +0000
commitc58d02b152b11bae78985aa441560f49ef6b5d09 (patch)
treec01bbbbe6ee86f60faf238a271c28dd03326ac5c /src/pubkey/ecc_key
parentf109029f5f1cc33512091e228e6ee6532058c42f (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')
-rw-r--r--src/pubkey/ecc_key/ecc_key.cpp28
-rw-r--r--src/pubkey/ecc_key/ecc_key.h8
2 files changed, 7 insertions, 29 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
diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h
index 29a08fba6..226427768 100644
--- a/src/pubkey/ecc_key/ecc_key.h
+++ b/src/pubkey/ecc_key/ecc_key.h
@@ -42,6 +42,8 @@ class BOTAN_DLL EC_PublicKey : public virtual Public_Key
AlgorithmIdentifier algorithm_identifier() const;
+ MemoryVector<byte> x509_subject_public_key() const;
+
/**
* Get the domain parameters of this key.
* @throw Invalid_State is thrown if the
@@ -71,12 +73,6 @@ class BOTAN_DLL EC_PublicKey : public virtual Public_Key
{ return domain_encoding; }
/**
- * Get an x509_encoder that can be used to encode this key.
- * @result an x509_encoder for this key
- */
- X509_Encoder* x509_encoder() const;
-
- /**
* Get an x509_decoder that can be used to decode a stored key into
* this key.
* @result an x509_decoder for this key