Work on SSL and Host accounts

This commit is contained in:
Deon George
2020-02-20 22:54:28 +11:00
parent 8311bfc268
commit 9ab30086fc
17 changed files with 225 additions and 20 deletions

View File

@@ -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
*