aboutsummaryrefslogtreecommitdiffstats
path: root/src/pkcs8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkcs8.cpp')
-rw-r--r--src/pkcs8.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/pkcs8.cpp b/src/pkcs8.cpp
index f7516ede3..da7746e49 100644
--- a/src/pkcs8.cpp
+++ b/src/pkcs8.cpp
@@ -24,23 +24,17 @@ namespace {
* Get info from an EncryptedPrivateKeyInfo *
*************************************************/
SecureVector<byte> PKCS8_extract(DataSource& source,
- AlgorithmIdentifier& alg_id)
+ AlgorithmIdentifier& pbe_alg_id)
{
- SecureVector<byte> enc_pkcs8_key;
+ SecureVector<byte> key_data;
- try {
- BER_Decoder decoder(source);
- BER_Decoder sequence = decoder.start_cons(SEQUENCE);
- sequence.decode(alg_id);
- sequence.decode(enc_pkcs8_key, OCTET_STRING);
- sequence.verify_end();
- }
- catch(Decoding_Error)
- {
- throw PKCS8_Exception("Private key decoding failed");
- }
+ BER_Decoder(source)
+ .start_cons(SEQUENCE)
+ .decode(pbe_alg_id)
+ .decode(key_data, OCTET_STRING)
+ .verify_end();
- return enc_pkcs8_key;
+ return key_data;
}
/*************************************************