diff options
author | lloyd <[email protected]> | 2006-07-01 21:31:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-07-01 21:31:59 +0000 |
commit | 6601628f84f52535adec1f34fe46c5e7039770cc (patch) | |
tree | b7f9c4fc8575b4c6bd1a1786a4bd2d539c3c2555 | |
parent | 6d3a4de1efcb6b04a1ab87037d487f979d7ca445 (diff) |
Make choose_sig_format a static member of Config rather than
a standalone function.
-rw-r--r-- | include/config.h | 15 | ||||
-rw-r--r-- | src/config.cpp | 37 | ||||
-rw-r--r-- | src/x509_ca.cpp | 2 | ||||
-rw-r--r-- | src/x509self.cpp | 2 |
4 files changed, 18 insertions, 38 deletions
diff --git a/include/config.h b/include/config.h index 61a22d46d..0b28cb848 100644 --- a/include/config.h +++ b/include/config.h @@ -34,6 +34,10 @@ class Config std::string option(const std::string&) const; void load_inifile(const std::string&); + + static void choose_sig_format(const std::string&, std::string&, + Signature_Format&); + private: std::map<std::string, std::string> settings; }; @@ -43,17 +47,6 @@ class Config *************************************************/ Config& global_config(); -namespace ConfigXXX { - -/************************************************* -* Choose the signature format for a PK algorithm * -*************************************************/ -void choose_sig_format(const std::string&, std::string&, Signature_Format&); -void choose_sig_format(const std::string&, std::string&, std::string&, - Signature_Format&); - -} - } #endif diff --git a/src/config.cpp b/src/config.cpp index 337deae2b..819bc61f5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -148,34 +148,15 @@ bool Config::option_as_bool(const std::string& key) const } /************************************************* -* Dereference an alias * -*************************************************/ -std::string deref_alias(const std::string& name) - { - return global_config().deref_alias(name); - } - -namespace ConfigXXX { - -/************************************************* * Choose the signature format for a PK algorithm * *************************************************/ -void choose_sig_format(const std::string& algo_name, std::string& padding, - Signature_Format& format) - { - std::string dummy; - choose_sig_format(algo_name, padding, dummy, format); - } - -/************************************************* -* Choose the signature format for a PK algorithm * -*************************************************/ -void choose_sig_format(const std::string& algo_name, std::string& padding, - std::string& hash, Signature_Format& format) +void Config::choose_sig_format(const std::string& algo_name, + std::string& padding, + Signature_Format& format) { if(algo_name == "RSA") { - hash = global_state().config().option("x509/ca/rsa_hash"); + std::string hash = global_state().config().option("x509/ca/rsa_hash"); if(hash == "") throw Invalid_State("No value set for x509/ca/rsa_hash"); @@ -187,7 +168,7 @@ void choose_sig_format(const std::string& algo_name, std::string& padding, } else if(algo_name == "DSA") { - hash = deref_alias("SHA-1"); + std::string hash = global_state().config().deref_alias("SHA-1"); padding = "EMSA1(" + hash + ")"; format = DER_SEQUENCE; } @@ -195,6 +176,12 @@ void choose_sig_format(const std::string& algo_name, std::string& padding, throw Invalid_Argument("Unknown X.509 signing key type: " + algo_name); } -} +/************************************************* +* Dereference an alias * +*************************************************/ +std::string deref_alias(const std::string& name) + { + return global_config().deref_alias(name); + } } diff --git a/src/x509_ca.cpp b/src/x509_ca.cpp index 23e79356f..fa4b7cf92 100644 --- a/src/x509_ca.cpp +++ b/src/x509_ca.cpp @@ -37,7 +37,7 @@ X509_CA::X509_CA(const X509_Certificate& c, std::string padding; Signature_Format format; - ConfigXXX::choose_sig_format(key.algo_name(), padding, format); + Config::choose_sig_format(key.algo_name(), padding, format); ca_sig_algo.oid = OIDS::lookup(key.algo_name() + "/" + padding); ca_sig_algo.parameters = key.DER_encode_params(); diff --git a/src/x509self.cpp b/src/x509self.cpp index da75aff18..fadcf0c39 100644 --- a/src/x509self.cpp +++ b/src/x509self.cpp @@ -63,7 +63,7 @@ PK_Signer* choose_sig_format(const PKCS8_PrivateKey& key, { std::string padding; Signature_Format format; - ConfigXXX::choose_sig_format(key.algo_name(), padding, format); + Config::choose_sig_format(key.algo_name(), padding, format); sig_algo.oid = OIDS::lookup(key.algo_name() + "/" + padding); sig_algo.parameters = key.DER_encode_params(); |