aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-01-28 07:19:38 +0000
committerlloyd <[email protected]>2007-01-28 07:19:38 +0000
commit0e8774107cc0f5a314db6f0c53e37f6340b7b5c8 (patch)
treee242eaf0a3829e4c8081bf34bfd7a008df4199f3
parent89830b069a44a78cec21174f2f4ec7e6c59d5152 (diff)
Minor cleanup of the PKCS8_extract function.
-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;
}
/*************************************************