diff options
Diffstat (limited to 'src/cert/x509cert')
-rw-r--r-- | src/cert/x509cert/x509_obj.cpp | 15 | ||||
-rw-r--r-- | src/cert/x509cert/x509_obj.h | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/cert/x509cert/x509_obj.cpp b/src/cert/x509cert/x509_obj.cpp index ffee74f12..27aaea3bf 100644 --- a/src/cert/x509cert/x509_obj.cpp +++ b/src/cert/x509cert/x509_obj.cpp @@ -145,6 +145,15 @@ AlgorithmIdentifier X509_Object::signature_algorithm() const /* * Check the signature on an object */ +bool X509_Object::check_signature(Public_Key* pub_key) const + { + std::auto_ptr<Public_Key> key(pub_key); + return check_signature(*key); + } + +/* +* Check the signature on an object +*/ bool X509_Object::check_signature(Public_Key& pub_key) const { try { @@ -195,15 +204,13 @@ void X509_Object::do_decode() } catch(Decoding_Error& e) { - const std::string what = e.what(); throw Decoding_Error(PEM_label_pref + " decoding failed (" + - what.substr(23, std::string::npos) + ")"); + e.what() + ")"); } catch(Invalid_Argument& e) { - const std::string what = e.what(); throw Decoding_Error(PEM_label_pref + " decoding failed (" + - what.substr(7, std::string::npos) + ")"); + e.what() + ")"); } } diff --git a/src/cert/x509cert/x509_obj.h b/src/cert/x509cert/x509_obj.h index 28ee95073..60c7c4db8 100644 --- a/src/cert/x509cert/x509_obj.h +++ b/src/cert/x509cert/x509_obj.h @@ -61,6 +61,14 @@ class BOTAN_DLL X509_Object bool check_signature(class Public_Key& key) const; /** + * Check the signature on this data + * @param key the public key purportedly used to sign this data + * the pointer will be deleted after use + * @return true if the signature is valid, otherwise false + */ + bool check_signature(class Public_Key* key) const; + + /** * Encode this to a pipe * @deprecated use BER_encode or PEM_encode instead * @param out the pipe to write to |