Work on SSL and Host accounts
This commit is contained in:
@@ -24,6 +24,7 @@ class SSL
|
||||
switch($key)
|
||||
{
|
||||
case 'cn': return $this->cn();
|
||||
case 'dn': return $this->dn();
|
||||
default:
|
||||
throw new \App\Exceptions\SSLUnknownAttribute($key);
|
||||
}
|
||||
@@ -67,6 +68,29 @@ class SSL
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function dn()
|
||||
{
|
||||
$dn = '';
|
||||
|
||||
if ($this->crt_pem) {
|
||||
$this->crt = openssl_x509_parse($this->crt_pem);
|
||||
$dn = Arr::get($this->crt,'name');
|
||||
}
|
||||
|
||||
if (! $dn AND $this->csr_pem) {
|
||||
$dna = openssl_csr_get_subject($this->csr_pem);
|
||||
|
||||
foreach ($dna as $k=>$v) {
|
||||
if ($dn)
|
||||
$dn .= ',';
|
||||
|
||||
$dn .= sprintf('%s=%s',$k,$v);
|
||||
}
|
||||
}
|
||||
|
||||
return $dn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Key
|
||||
*
|
||||
|
Reference in New Issue
Block a user