64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class is for access to SSL information
|
|
*
|
|
* @package OSB
|
|
* @subpackage System
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) 2010 Open Source Billing
|
|
* @license http://dev.osbill.net/license.html
|
|
*/
|
|
class SSL {
|
|
public static function instance() {
|
|
return new SSL;
|
|
}
|
|
|
|
public static function details($key) {
|
|
return openssl_x509_parse($key);
|
|
}
|
|
|
|
public static function issuer($key) {
|
|
$k = static::details($key);
|
|
return $k['issuer']['CN'];
|
|
}
|
|
|
|
public static function from($key,$format=FALSE) {
|
|
$k = static::details($key);
|
|
return $format ? Config::date($k['validFrom_time_t']) : $k['validFrom_time_t'];
|
|
}
|
|
|
|
public static function expire($key,$format=FALSE) {
|
|
$k = static::details($key);
|
|
return $format ? Config::date($k['validTo_time_t']) : $k['validTo_time_t'];
|
|
}
|
|
|
|
public static function hash($key) {
|
|
$k = static::details($key);
|
|
return $k['hash'];
|
|
}
|
|
|
|
public static function serial($key) {
|
|
$k = static::details($key);
|
|
return $k['serialNumber'];
|
|
}
|
|
|
|
public static function subject($key) {
|
|
$k = static::details($key);
|
|
return $k['subject']['CN'];
|
|
}
|
|
|
|
public static function version($key) {
|
|
$k = static::details($key);
|
|
return $k['version'];
|
|
}
|
|
|
|
public static function csrsubject($csr) {
|
|
$c = openssl_csr_get_subject($csr);
|
|
|
|
return $c['CN'];
|
|
}
|
|
}
|
|
?>
|