diff options
author | lloyd <[email protected]> | 2006-09-10 03:18:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-10 03:18:35 +0000 |
commit | 3af61dd588df052eb100e0c581860edfc1cb09c3 (patch) | |
tree | 1d9466c23241e8963f9be567496716348887ab5a /src | |
parent | 9e26ffdb32e39ed58b99ab5f0a4f4dc2496127fc (diff) |
Hack around some Visual Studio bugs that I can't seem to find good solutions
for.
Diffstat (limited to 'src')
-rw-r--r-- | src/if_algo.cpp | 3 | ||||
-rw-r--r-- | src/oids.cpp | 8 | ||||
-rw-r--r-- | src/x509cert.cpp | 14 | ||||
-rw-r--r-- | src/x509stat.cpp | 26 |
4 files changed, 35 insertions, 16 deletions
diff --git a/src/if_algo.cpp b/src/if_algo.cpp index afa428fde..5af691aa2 100644 --- a/src/if_algo.cpp +++ b/src/if_algo.cpp @@ -139,8 +139,7 @@ PKCS8_Decoder* IF_Scheme_PrivateKey::pkcs8_decoder() .end_cons(); if(version != 0) - throw Decoding_Error(key->algo_name() + - ": Unknown PKCS #1 key version"); + throw Decoding_Error("Unknown PKCS #1 key format version"); key->PKCS8_load_hook(); } diff --git a/src/oids.cpp b/src/oids.cpp index 6b96b3656..92a89bbb6 100644 --- a/src/oids.cpp +++ b/src/oids.cpp @@ -53,6 +53,14 @@ bool have_oid(const std::string& name) return global_config().is_set("str2oid", name); } +/************************************************* +* Check to see if an OID exists in the table * +*************************************************/ +bool name_of(const OID& oid, const std::string& name) + { + return (oid == lookup(name)); + } + } } diff --git a/src/x509cert.cpp b/src/x509cert.cpp index 4a1152cf5..8696404fa 100644 --- a/src/x509cert.cpp +++ b/src/x509cert.cpp @@ -335,14 +335,22 @@ AlternativeName create_alt_name(const Data_Store& info) public: bool operator()(const std::string& key, const std::string&) const { - if(key == "RFC882" || key == "DNS" || key == "URI") - return true; + for(u32bit j = 0; j != matches.size(); j++) + if(key.compare(matches[j]) == 0) + return true; return false; } + + AltName_Matcher(const std::string& match_any_of) + { + matches = split_on(match_any_of, '/'); + } + private: + std::vector<std::string> matches; }; std::multimap<std::string, std::string> names - = info.search_with(AltName_Matcher()); + = info.search_with(AltName_Matcher("RFC882/DNS/URI")); AlternativeName alt_name; diff --git a/src/x509stat.cpp b/src/x509stat.cpp index 3ea431962..059e43414 100644 --- a/src/x509stat.cpp +++ b/src/x509stat.cpp @@ -34,17 +34,21 @@ Certificate_Extension* X509_GlobalState::get_extension(const OID& oid) const *************************************************/ X509_GlobalState::X509_GlobalState() { -#define CREATE_PROTOTYPE(NAME, TYPE) \ - struct TYPE ## _Prototype : public Extension_Prototype \ - { \ - Certificate_Extension* make(const OID& oid) \ - { \ - if(oid == OIDS::lookup(NAME)) \ - return new Cert_Extension::TYPE(); \ - return 0; \ - } \ - }; \ - add(new TYPE ## _Prototype); + +#define CREATE_PROTOTYPE(NAME, TYPE) \ + do { \ + struct TYPE ## _Prototype : public Extension_Prototype \ + { \ + Certificate_Extension* make(const OID& oid) \ + { \ + if(OIDS::name_of(oid, NAME)) \ + return new Cert_Extension::TYPE(); \ + return 0; \ + } \ + }; \ + \ + add(new TYPE ## _Prototype); \ + } while(0); CREATE_PROTOTYPE("X509v3.KeyUsage", Key_Usage); CREATE_PROTOTYPE("X509v3.BasicConstraints", Basic_Constraints); |