diff options
Diffstat (limited to 'src/lib/pubkey/pk_algs.cpp')
-rw-r--r-- | src/lib/pubkey/pk_algs.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp index 074149dac..fc8697585 100644 --- a/src/lib/pubkey/pk_algs.cpp +++ b/src/lib/pubkey/pk_algs.cpp @@ -6,7 +6,6 @@ */ #include <botan/pk_algs.h> -#include <botan/oids.h> #include <botan/parsing.h> #if defined(BOTAN_HAS_RSA) @@ -83,13 +82,8 @@ std::unique_ptr<Public_Key> load_public_key(const AlgorithmIdentifier& alg_id, const std::vector<uint8_t>& key_bits) { - const std::string oid_str = OIDS::oid2str_or_empty(alg_id.get_oid()); - - if(oid_str.empty()) - throw Decoding_Error("Unknown algorithm OID: " + alg_id.get_oid().to_string()); - + const std::string oid_str = alg_id.get_oid().to_formatted_string(); const std::vector<std::string> alg_info = split_on(oid_str, '/'); - const std::string alg_name = alg_info[0]; #if defined(BOTAN_HAS_RSA) @@ -162,16 +156,14 @@ load_public_key(const AlgorithmIdentifier& alg_id, return std::unique_ptr<Public_Key>(new XMSS_PublicKey(key_bits)); #endif - throw Decoding_Error("Unhandled PK algorithm " + alg_name); + throw Decoding_Error("Unknown or unavailable public key algorithm " + alg_name); } std::unique_ptr<Private_Key> load_private_key(const AlgorithmIdentifier& alg_id, const secure_vector<uint8_t>& key_bits) { - const std::string alg_name = OIDS::oid2str_or_empty(alg_id.get_oid()); - if(alg_name.empty()) - throw Decoding_Error("Unknown algorithm OID: " + alg_id.get_oid().to_string()); + const std::string alg_name = alg_id.get_oid().to_formatted_string(); #if defined(BOTAN_HAS_RSA) if(alg_name == "RSA") @@ -243,7 +235,7 @@ load_private_key(const AlgorithmIdentifier& alg_id, return std::unique_ptr<Private_Key>(new XMSS_PrivateKey(key_bits)); #endif - throw Decoding_Error("Unhandled PK algorithm " + alg_name); + throw Decoding_Error("Unknown or unavailable public key algorithm " + alg_name); } #if defined(BOTAN_HAS_ECC_GROUP) |