diff options
| author | Gordon Sim <gsim@apache.org> | 2010-04-28 19:50:23 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2010-04-28 19:50:23 +0000 |
| commit | 53733662c8da9e336c869f5edcd31dc336070b1e (patch) | |
| tree | 0453471dc84edf4bfc411e8fd28c1e1953c1c842 /cpp/src/qpid | |
| parent | 20178b8bbc5b55d982848eac660e0704f6f80d5b (diff) | |
| download | qpid-python-53733662c8da9e336c869f5edcd31dc336070b1e.tar.gz | |
QPID-2083: Added some error messages for particular codes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@939066 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/sys/ssl/check.cpp | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/cpp/src/qpid/sys/ssl/check.cpp b/cpp/src/qpid/sys/ssl/check.cpp index d4367226eb..77da1059af 100644 --- a/cpp/src/qpid/sys/ssl/check.cpp +++ b/cpp/src/qpid/sys/ssl/check.cpp @@ -30,17 +30,6 @@ namespace qpid { namespace sys { namespace ssl { -const std::string SSL_ERROR_BAD_CERT_DOMAIN_STR = - "Unable to communicate securely with peer: requested domain name does not match the server's certificate."; -const std::string SSL_ERROR_BAD_CERT_ALERT_STR = "SSL peer cannot verify your certificate."; -const std::string SEC_ERROR_BAD_DATABASE_STR = "Security library: bad database."; -const std::string SSL_ERROR_NO_CERTIFICATE_STR = "Unable to find the certificate or key necessary for authentication."; -const std::string PR_DIRECTORY_LOOKUP_ERROR_STR = "A directory lookup on a network address has failed"; -const std::string PR_CONNECT_RESET_ERROR_STR = "TCP connection reset by peer"; -const std::string PR_END_OF_FILE_ERROR_STR = "Encountered end of file"; -const std::string SSL_ERROR_UNKNOWN = "NSS error"; -const std::string NSPR_ERROR_UNKNOWN = "NSPR error"; - ErrorString::ErrorString() : code(PR_GetError()), buffer(new char[PR_GetErrorTextLength()]), used(PR_GetErrorText(buffer)) {} ErrorString::~ErrorString() @@ -65,14 +54,22 @@ std::string getErrorString(int code) { std::string msg; switch (code) { - case SSL_ERROR_BAD_CERT_DOMAIN: msg = SSL_ERROR_BAD_CERT_DOMAIN_STR; break; - case SSL_ERROR_BAD_CERT_ALERT: msg = SSL_ERROR_BAD_CERT_ALERT_STR; break; - case SEC_ERROR_BAD_DATABASE: msg = SEC_ERROR_BAD_DATABASE_STR; break; - case SSL_ERROR_NO_CERTIFICATE: msg = SSL_ERROR_NO_CERTIFICATE_STR; break; - case PR_DIRECTORY_LOOKUP_ERROR: msg = PR_DIRECTORY_LOOKUP_ERROR_STR; break; - case PR_CONNECT_RESET_ERROR: msg = PR_CONNECT_RESET_ERROR_STR; break; - case PR_END_OF_FILE_ERROR: msg = PR_END_OF_FILE_ERROR_STR; break; - default: msg = (code < -6000) ? SSL_ERROR_UNKNOWN : NSPR_ERROR_UNKNOWN; break; + case SSL_ERROR_EXPORT_ONLY_SERVER: msg = "Unable to communicate securely. Peer does not support high-grade encryption."; break; + case SSL_ERROR_US_ONLY_SERVER: msg = "Unable to communicate securely. Peer requires high-grade encryption which is not supported."; break; + case SSL_ERROR_NO_CYPHER_OVERLAP: msg = "Cannot communicate securely with peer: no common encryption algorithm(s)."; break; + case SSL_ERROR_NO_CERTIFICATE: msg = "Unable to find the certificate or key necessary for authentication."; break; + case SSL_ERROR_BAD_CERTIFICATE: msg = "Unable to communicate securely with peer: peers's certificate was rejected."; break; + case SSL_ERROR_UNSUPPORTED_CERTIFICATE_TYPE: msg = "Unsupported certificate type."; break; + case SSL_ERROR_WRONG_CERTIFICATE: msg = "Client authentication failed: private key in key database does not correspond to public key in certificate database."; break; + case SSL_ERROR_BAD_CERT_DOMAIN: msg = "Unable to communicate securely with peer: requested domain name does not match the server's certificate."; break; + case SSL_ERROR_BAD_CERT_ALERT: msg = "SSL peer cannot verify your certificate."; break; + case SSL_ERROR_REVOKED_CERT_ALERT: msg = "SSL peer rejected your certificate as revoked."; break; + case SSL_ERROR_EXPIRED_CERT_ALERT: msg = "SSL peer rejected your certificate as expired."; break; + + case PR_DIRECTORY_LOOKUP_ERROR: msg = "A directory lookup on a network address has failed"; break; + case PR_CONNECT_RESET_ERROR: msg = "TCP connection reset by peer"; break; + case PR_END_OF_FILE_ERROR: msg = "Encountered end of file"; break; + default: msg = (code < -6000) ? "NSS error" : "NSPR error"; break; } return str(format("%1% [%2%]") % msg % code); } |
