5#if !defined(DART_IO_SECURE_SOCKET_DISABLED)
9#include <openssl/err.h>
10#include <openssl/ssl.h>
32 const char* path =
nullptr;
34 uint32_t
error = ERR_get_error_line(&path, &line);
41 text_buffer->
Printf(
"\n\t%s", ERR_reason_error_string(
error));
42 if ((ssl !=
nullptr) && (ERR_GET_LIB(
error) == ERR_LIB_SSL) &&
43 (ERR_GET_REASON(
error) == SSL_R_CERTIFICATE_VERIFY_FAILED)) {
44 intptr_t
result = SSL_get_verify_result(ssl);
45 text_buffer->
Printf(
": %s", X509_verify_cert_error_string(
result));
47 if ((path !=
nullptr) && (line >= 0)) {
48 const char* file = strrchr(path, sep[0]);
49 path = file !=
nullptr ? file + 1 : path;
50 text_buffer->
Printf(
"(%s:%d)", path, line);
58 const char* exception_type,
88 int error = ERR_get_error();
104 ASN1_TIME* not_before = X509_get_notBefore(root_cert);
105 ASN1_TIME* not_after = X509_get_notAfter(root_cert);
106 int days_since_valid = 0;
107 int secs_since_valid = 0;
108 int days_before_invalid = 0;
109 int secs_before_invalid = 0;
111 ASN1_TIME_diff(&days_since_valid, &secs_since_valid, not_before,
113 ASN1_TIME_diff(&days_before_invalid, &secs_before_invalid,
115 return days_since_valid >= 0 && secs_since_valid >= 0 &&
116 days_before_invalid >= 0 && secs_before_invalid >= 0;
intptr_t Printf(const char *format,...) PRINTF_ATTRIBUTE(2
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Dart_Handle NewDartOSError()
static Dart_Handle NewDartIOException(const char *exception_name, const char *message, Dart_Handle os_error)
static const char * PathSeparator()
static constexpr int SSL_ERROR_MESSAGE_BUFFER_SIZE
static bool IsCurrentTimeInsideCertValidDateRange(X509 *root_cert)
static void ThrowIOException(int status, const char *exception_type, const char *message, const SSL *ssl)
static uint32_t FetchErrorString(const SSL *ssl, TextBuffer *text_buffer)
static void CheckStatusSSL(int status, const char *type, const char *message, const SSL *ssl)
static void CheckStatus(int status, const char *type, const char *message)
struct _Dart_Handle * Dart_Handle
const uint8_t uint32_t uint32_t GError ** error
const bool SSL_LOG_STATUS
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)