WordPress at a glance
function is not described

Requests_SSL::verify_certificate() public WP 1.0

Verify the certificate against common name and subject alternative names

Unfortunately, PHP doesn't check the certificate against the alternative names, leading things like 'https://www.github.com/' to be invalid. Instead

{} It's a method of the class: Requests_SSL{}

No Hooks.

Return

true/false.

Usage

$result = Requests_SSL::verify_certificate( $host, $cert );
$host(string) (required)
Host name to verify against
$cert(array) (required)
Certificate data from openssl_x509_parse()

Notes

Code of Requests_SSL::verify_certificate() WP 5.5.1

<?php
public static function verify_certificate($host, $cert) {
	// Calculate the valid wildcard match if the host is not an IP address
	$parts = explode('.', $host);
	if (ip2long($host) === false) {
		$parts[0] = '*';
	}
	$wildcard = implode('.', $parts);

	$has_dns_alt = false;

	// Check the subjectAltName
	if (!empty($cert['extensions']) && !empty($cert['extensions']['subjectAltName'])) {
		$altnames = explode(',', $cert['extensions']['subjectAltName']);
		foreach ($altnames as $altname) {
			$altname = trim($altname);
			if (strpos($altname, 'DNS:') !== 0) {
				continue;
			}

			$has_dns_alt = true;

			// Strip the 'DNS:' prefix and trim whitespace
			$altname = trim(substr($altname, 4));

			// Check for a match
			if (self::match_domain($host, $altname) === true) {
				return true;
			}
		}
	}

	// Fall back to checking the common name if we didn't get any dNSName
	// alt names, as per RFC2818
	if (!$has_dns_alt && !empty($cert['subject']['CN'])) {
		// Check for a match
		if (self::match_domain($host, $cert['subject']['CN']) === true) {
			return true;
		}
	}

	return false;
}