diff options
Diffstat (limited to 'src/lib/pubkey/pkcs8.cpp')
-rw-r--r-- | src/lib/pubkey/pkcs8.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp index f6d50256d..d299a98a4 100644 --- a/src/lib/pubkey/pkcs8.cpp +++ b/src/lib/pubkey/pkcs8.cpp @@ -105,7 +105,7 @@ secure_vector<uint8_t> PKCS8_decode( if(is_encrypted) { if(OIDS::lookup(pbe_alg_id.get_oid()) != "PBE-PKCS5v20") - throw Exception("Unknown PBE type " + pbe_alg_id.get_oid().as_string()); + throw PKCS8_Exception("Unknown PBE type " + pbe_alg_id.get_oid().as_string()); #if defined(BOTAN_HAS_PKCS5_PBES2) key = pbes2_decrypt(key_data, get_passphrase(), pbe_alg_id.get_parameters()); #else @@ -167,10 +167,13 @@ choose_pbe_params(const std::string& pbe_algo, const std::string& key_algo) } SCAN_Name request(pbe_algo); - if(request.arg_count() != 2) - throw Exception("Unsupported PBE " + pbe_algo); - if(request.algo_name() != "PBE-PKCS5v20" && request.algo_name() != "PBES2") - throw Exception("Unsupported PBE " + pbe_algo); + + if(request.arg_count() != 2 || + (request.algo_name() != "PBE-PKCS5v20" && request.algo_name() != "PBES2")) + { + throw Invalid_Argument("Unsupported PBE " + pbe_algo); + } + return std::make_pair(request.arg(0), request.arg(1)); } |