SSL, Google Chart updates, lnAPP improvements

This commit is contained in:
Deon George
2012-12-11 08:48:30 +11:00
parent c4e760fa21
commit 6588de4f7f
67 changed files with 940 additions and 539 deletions

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_SSL extends ORMOSB {
class Model_SSL extends ORM_OSB {
protected $_updated_column = FALSE;
}
?>

View File

@@ -10,7 +10,7 @@
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_SSL_CA extends ORMOSB {
class Model_SSL_CA extends ORM_OSB {
protected $_updated_column = FALSE;
// Relationships

View File

@@ -35,6 +35,28 @@ class SSL {
return _('Unknown');
}
public static function aki($cert,$key=NULL) {
$k = array();
foreach (explode("\n",preg_replace("/\n$/",'',static::extensions($cert,'authorityKeyIdentifier'))) as $x) {
list($a,$b) = explode(":",$x,2);
$k[strtolower($a)] = $b;
}
return is_null($key) ? $k : $k[$key];
}
public static function aki_keyid($key) {
return static::aki($key,'keyid');
}
public static function aki_dirname($key) {
return static::aki($key,'dirname');
}
public static function aki_serial($key) {
return static::aki($key,'serial');
}
public static function dn($cert) {
if (! $cert)
return '';
@@ -84,12 +106,17 @@ class SSL {
return $format ? Config::date($k) : $k;
}
public static function extensions($cert,$key=NULL) {
$k = static::details($cert,'extensions');
return is_null($key) ? $k : $k[$key];
}
public static function hash($key) {
return static::details($key,'hash');
}
public static function serial($key) {
return static::details($key,'serialNumber');
return static::dec_to_hex(static::details($key,'serialNumber'));
}
public static function subject($key) {
@@ -97,6 +124,10 @@ class SSL {
return $k['CN'];
}
public static function ski($key) {
return static::extensions($key,'subjectKeyIdentifier');
}
public static function version($key) {
return static::details($key,'version');
}
@@ -106,5 +137,25 @@ class SSL {
return $c['CN'];
}
private static function dec_to_hex($number) {
$hex = array();
if ($number == 0)
return '00';
while ($number > 0) {
if ($number == 0) {
array_push($hex, '0');
} else {
$x = (int) ($number/16);
array_push($hex,strtoupper(dechex((int)($number-($x*16)))));
$number = $x;
}
}
return preg_replace('/^:/','',preg_replace('/(..)/',":$1",implode(array_reverse($hex))));
}
}
?>