aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/pk_codecs/pkcs8.cpp
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/pk_codecs/pkcs8.cpp
parentc58d02b152b11bae78985aa441560f49ef6b5d09 (diff)
Add a pkcs8_private_key similiar to x509_subject_public_key
Diffstat (limited to 'src/pubkey/pk_codecs/pkcs8.cpp')
-rw-r--r--src/pubkey/pk_codecs/pkcs8.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/pubkey/pk_codecs/pkcs8.cpp b/src/pubkey/pk_codecs/pkcs8.cpp
index d0954df39..099d52ffa 100644
--- a/src/pubkey/pk_codecs/pkcs8.cpp
+++ b/src/pubkey/pk_codecs/pkcs8.cpp
@@ -138,18 +138,14 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui,
*/
void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding)
{
- std::auto_ptr<PKCS8_Encoder> encoder(key.pkcs8_encoder());
- if(!encoder.get())
- throw Encoding_Error("PKCS8::encode: Key does not support encoding");
-
const u32bit PKCS8_VERSION = 0;
SecureVector<byte> contents =
DER_Encoder()
.start_cons(SEQUENCE)
.encode(PKCS8_VERSION)
- .encode(encoder->alg_id())
- .encode(encoder->key_bits(), OCTET_STRING)
+ .encode(key.algorithm_identifier())
+ .encode(key.pkcs8_private_key(), OCTET_STRING)
.end_cons()
.get_contents();