diff options
author | lloyd <[email protected]> | 2008-11-09 23:12:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-09 23:12:47 +0000 |
commit | 5d631f6c16dc62735d0be2005e3ff285655dc9f1 (patch) | |
tree | 0426e440d073e1b501002fe6d48d66506dadc02b /src/pbe/get_pbe.cpp | |
parent | 7eeb28e05d273abd0f634cd2b3dc996fa0feb4d2 (diff) |
Modify get_pbe to use SCAN_Name
Diffstat (limited to 'src/pbe/get_pbe.cpp')
-rw-r--r-- | src/pbe/get_pbe.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/pbe/get_pbe.cpp b/src/pbe/get_pbe.cpp index cd8fa17c8..34f60e241 100644 --- a/src/pbe/get_pbe.cpp +++ b/src/pbe/get_pbe.cpp @@ -5,7 +5,7 @@ #include <botan/get_pbe.h> #include <botan/oids.h> -#include <botan/parsing.h> +#include <botan/scan_name.h> #if defined(BOTAN_HAS_PBE_PKCS_V15) #include <botan/pbes1.h> @@ -22,15 +22,14 @@ namespace Botan { *************************************************/ PBE* get_pbe(const std::string& pbe_name) { - std::vector<std::string> algo_name; - algo_name = parse_algorithm_name(pbe_name); + SCAN_Name request(pbe_name); - if(algo_name.size() != 3) + if(request.arg_count() != 2) throw Invalid_Algorithm_Name(pbe_name); - const std::string pbe = algo_name[0]; - const std::string digest = algo_name[1]; - const std::string cipher = algo_name[2]; + const std::string pbe = request.algo_name(); + const std::string digest = request.argument(0); + const std::string cipher = request.argument(1); #if defined(BOTAN_HAS_PBE_PKCS_V15) if(pbe == "PBE-PKCS5v15") @@ -50,21 +49,16 @@ PBE* get_pbe(const std::string& pbe_name) *************************************************/ PBE* get_pbe(const OID& pbe_oid, DataSource& params) { - std::vector<std::string> algo_name; - algo_name = parse_algorithm_name(OIDS::lookup(pbe_oid)); - - if(algo_name.size() < 1) - throw Invalid_Algorithm_Name(pbe_oid.as_string()); - const std::string pbe_algo = algo_name[0]; + SCAN_Name request(OIDS::lookup(pbe_oid)); #if defined(BOTAN_HAS_PBE_PKCS_V15) - if(pbe_algo == "PBE-PKCS5v15") + if(request.algo_name() == "PBE-PKCS5v15") { - if(algo_name.size() != 3) + if(request.arg_count() != 2) throw Invalid_Algorithm_Name(pbe_oid.as_string()); - const std::string digest = algo_name[1]; - const std::string cipher = algo_name[2]; + const std::string digest = request.argument(0); + const std::string cipher = request.argument(1); PBE* pbe = new PBE_PKCS5v15(digest, cipher, DECRYPTION); pbe->decode_params(params); @@ -73,7 +67,7 @@ PBE* get_pbe(const OID& pbe_oid, DataSource& params) #endif #if defined(BOTAN_HAS_PBE_PKCS_V20) - if(pbe_algo == "PBE-PKCS5v20") + if(request.algo_name() == "PBE-PKCS5v20") return new PBE_PKCS5v20(params); #endif |