public function verify_certificate_from_context($host,
$context) { $meta =
stream_context_get_options($context);
// If we don't have SSL options, then we couldn't make the connection at
// all
if (empty($meta) ||
empty($meta['ssl'
]) ||
empty($meta['ssl'
]['peer_certificate'
])) { throw new Exception(rtrim($this->connect_error
), 'ssl.connect_error'
);
} $cert =
openssl_x509_parse($meta['ssl'
]['peer_certificate'
]);
return Ssl::
verify_certificate($host,
$cert);
} /**
* Self-test whether the transport can be used.
*
* The available capabilities to test for can be found in {@see \WpOrg\Requests\Capability}.
*
* @codeCoverageIgnore
* @param array<string, bool> $capabilities Optional. Associative array of capabilities to test against, i.e. `['<capability>' => true]`.
* @return bool Whether the transport can be used.
*/