Skip to content

Instantly share code, notes, and snippets.

@philals
Last active November 22, 2016 23:41
Show Gist options
  • Save philals/e56eaac76e5eaf502fa8a4ceba9d2dd8 to your computer and use it in GitHub Desktop.
Save philals/e56eaac76e5eaf502fa8a4ceba9d2dd8 to your computer and use it in GitHub Desktop.
if ($this->config ['application_type'] == 'Partner') {
if (! file_get_contents ( $this->config ['curl_ssl_cert'] )) {
$testOutput ['ssl_cert_error'] = "Can't read the Xero Entrust cert. You need one for partner API applications. http://developer.xero.com/documentation/getting-started/partner-applications/ \n";
} else {
$data = openssl_x509_parse ( file_get_contents ( $this->config ['curl_ssl_cert'] ) );
$validFrom = date ( 'Y-m-d H:i:s', $data ['validFrom_time_t'] );
if (time () < $data ['validFrom_time_t']) {
$testOutput ['ssl_cert_error'] = "Xero Entrust cert not yet valid - cert valid from " . $validFrom . "\n";
}
$validTo = date ( 'Y-m-d H:i:s', $data ['validTo_time_t'] );
if (time () > $data ['validTo_time_t']) {
$testOutput ['ssl_cert_error'] = "Xero Entrust cert expired - cert valid to " . $validFrom . "\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment