* Returns a human-readable error string for situations where IsVerifyOK() returns false. * * If the handshake was completed and a peer certificate was provided, * the string additionally contains the OpenSSL verification error code. * * @return string containing the error message */
| 50 | * @return string containing the error message |
| 51 | */ |
| 52 | String UnbufferedAsioTlsStream::GetVerifyError() |
| 53 | { |
| 54 | if (!SSL_is_init_finished(native_handle())) { |
| 55 | return "handshake not completed"; |
| 56 | } |
| 57 | |
| 58 | if (GetPeerCertificate() == nullptr) { |
| 59 | return "no peer certificate provided"; |
| 60 | } |
| 61 | |
| 62 | std::ostringstream buf; |
| 63 | long err = SSL_get_verify_result(native_handle()); |
| 64 | buf << "code " << err << ": " << X509_verify_cert_error_string(err); |
| 65 | return buf.str(); |
| 66 | } |
| 67 | |
| 68 | std::shared_ptr<X509> UnbufferedAsioTlsStream::GetPeerCertificate() |
| 69 | { |
no outgoing calls
no test coverage detected