From 0e8774107cc0f5a314db6f0c53e37f6340b7b5c8 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 28 Jan 2007 07:19:38 +0000 Subject: Minor cleanup of the PKCS8_extract function. --- src/pkcs8.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/pkcs8.cpp') 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 PKCS8_extract(DataSource& source, - AlgorithmIdentifier& alg_id) + AlgorithmIdentifier& pbe_alg_id) { - SecureVector enc_pkcs8_key; + SecureVector 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; } /************************************************* -- cgit v1.2.3