aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dl_algo
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 01:53:35 +0000
committerlloyd <[email protected]>2010-03-04 01:53:35 +0000
commitf109029f5f1cc33512091e228e6ee6532058c42f (patch)
tree203d32fec16d05a2fc6c6f72346cb13a2796c71e /src/pubkey/dl_algo
parent547e295717780c28878f17b7273a7d60c1bf39c6 (diff)
Add a new function to Public_Key, algorithm_identifier(), which just
returns the AlgorithmIdentifier representing this scheme (OID + domain params if any).
Diffstat (limited to 'src/pubkey/dl_algo')
-rw-r--r--src/pubkey/dl_algo/dl_algo.cpp16
-rw-r--r--src/pubkey/dl_algo/dl_algo.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp
index 8ce34465a..beaf10695 100644
--- a/src/pubkey/dl_algo/dl_algo.cpp
+++ b/src/pubkey/dl_algo/dl_algo.cpp
@@ -12,6 +12,12 @@
namespace Botan {
+AlgorithmIdentifier DL_Scheme_PublicKey::algorithm_identifier() const
+ {
+ return AlgorithmIdentifier(get_oid(),
+ group.DER_encode(group_format()));
+ }
+
/*
* Return the X.509 public key encoder
*/
@@ -22,10 +28,7 @@ X509_Encoder* DL_Scheme_PublicKey::x509_encoder() const
public:
AlgorithmIdentifier alg_id() const
{
- MemoryVector<byte> group =
- key->group.DER_encode(key->group_format());
-
- return AlgorithmIdentifier(key->get_oid(), group);
+ return key->algorithm_identifier();
}
MemoryVector<byte> key_bits() const
@@ -79,10 +82,7 @@ PKCS8_Encoder* DL_Scheme_PrivateKey::pkcs8_encoder() const
public:
AlgorithmIdentifier alg_id() const
{
- MemoryVector<byte> group =
- key->group.DER_encode(key->group_format());
-
- return AlgorithmIdentifier(key->get_oid(), group);
+ return key->algorithm_identifier();
}
MemoryVector<byte> key_bits() const
diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h
index 256ce96ee..1fa99a49b 100644
--- a/src/pubkey/dl_algo/dl_algo.h
+++ b/src/pubkey/dl_algo/dl_algo.h
@@ -23,6 +23,8 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
public:
bool check_key(RandomNumberGenerator& rng, bool) const;
+ AlgorithmIdentifier algorithm_identifier() const;
+
/**
* Get the DL domain parameters of this key.
* @return the DL domain parameters of this key