Commit c8c2bb63 authored by ale's avatar ale

include NaCl error message in the exception raised from verify()

parent 9dc1095a
......@@ -37,14 +37,20 @@ namespace sso {
class sso_error : public std::exception {
public:
sso_error(const char *s)
: str_(s)
: str_(s)
{}
sso_error(const std::string& s)
: str_(s)
{}
virtual ~sso_error() throw() {}
const char *what() const throw() {
return str_;
return str_.c_str();
}
const char *str_;
std::string str_;
};
std::string read_key_from_file(const std::string& path);
......
......@@ -69,8 +69,11 @@ Ticket *Verifier::verify(const string& ticket_string) throw(sso_error)
// Decode the ticket from the unsigned string.
ticket = new Ticket(verified_ticket_string);
} catch(...) {
throw sso_error("signature verification failure");
} catch(const char *err) {
// Yes, NaCl throws a const char*.
string reason("signature verification failure: ");
reason += err;
throw sso_error(reason);
}
// Verification phase.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment