aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert/x509cert/x509_obj.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cert/x509cert/x509_obj.cpp')
-rw-r--r--src/cert/x509cert/x509_obj.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cert/x509cert/x509_obj.cpp b/src/cert/x509cert/x509_obj.cpp
index 41bbbef6b..13193f09c 100644
--- a/src/cert/x509cert/x509_obj.cpp
+++ b/src/cert/x509cert/x509_obj.cpp
@@ -143,6 +143,27 @@ AlgorithmIdentifier X509_Object::signature_algorithm() const
}
/*
+* Return the hash used in generating the signature
+*/
+std::string X509_Object::hash_used_for_signature() const
+ {
+ std::vector<std::string> sig_info =
+ split_on(OIDS::lookup(sig_algo.oid), '/');
+
+ if(sig_info.size() != 2)
+ throw Internal_Error("Invalid name format found for " +
+ sig_algo.oid.as_string());
+
+ std::vector<std::string> pad_and_hash =
+ parse_algorithm_name(sig_info[1]);
+
+ if(pad_and_hash.size() != 2)
+ throw Internal_Error("Invalid name format " + sig_info[1]);
+
+ return pad_and_hash[1];
+ }
+
+/*
* Check the signature on an object
*/
bool X509_Object::check_signature(Public_Key* pub_key) const