aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dl_algo
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 02:15:10 +0000
committerlloyd <[email protected]>2010-03-04 02:15:10 +0000
commitbc66f1dc8ace6b81c486392422d3302afd674f37 (patch)
treeed273b76330fc371a17eb142196efb0c0222d547 /src/pubkey/dl_algo
parentc58d02b152b11bae78985aa441560f49ef6b5d09 (diff)
Add a pkcs8_private_key similiar to x509_subject_public_key
Diffstat (limited to 'src/pubkey/dl_algo')
-rw-r--r--src/pubkey/dl_algo/dl_algo.cpp7
-rw-r--r--src/pubkey/dl_algo/dl_algo.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp
index b8f96bcf1..bab535c69 100644
--- a/src/pubkey/dl_algo/dl_algo.cpp
+++ b/src/pubkey/dl_algo/dl_algo.cpp
@@ -51,6 +51,11 @@ X509_Decoder* DL_Scheme_PublicKey::x509_decoder()
return new DL_Scheme_Decoder(this);
}
+MemoryVector<byte> DL_Scheme_PrivateKey::pkcs8_private_key() const
+ {
+ return DER_Encoder().encode(x).get_contents();
+ }
+
/*
* Return the PKCS #8 private key encoder
*/
@@ -66,7 +71,7 @@ PKCS8_Encoder* DL_Scheme_PrivateKey::pkcs8_encoder() const
MemoryVector<byte> key_bits() const
{
- return DER_Encoder().encode(key->x).get_contents();
+ return key->pkcs8_private_key();
}
DL_Scheme_Encoder(const DL_Scheme_PrivateKey* k) : key(k) {}
diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h
index 63875d27b..e06630011 100644
--- a/src/pubkey/dl_algo/dl_algo.h
+++ b/src/pubkey/dl_algo/dl_algo.h
@@ -96,6 +96,8 @@ class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
*/
PKCS8_Encoder* pkcs8_encoder() const;
+ MemoryVector<byte> pkcs8_private_key() const;
+
/**
* Get an PKCS#8 decoder for this key.
* @param rng the rng to use