|
@@ 91-100 (lines=10) @@
|
| 88 |
|
* @return array the certificate, key in array with keys |
| 89 |
|
* 'cert', 'key', 'valid_from' and 'valid_to' |
| 90 |
|
*/ |
| 91 |
|
public function serverCert($commonName) |
| 92 |
|
{ |
| 93 |
|
if ($this->hasCert($commonName)) { |
| 94 |
|
throw new CaException(sprintf('certificate with commonName "%s" already exists', $commonName)); |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
$this->execEasyRsa(['build-server-full', $commonName, 'nopass']); |
| 98 |
|
|
| 99 |
|
return $this->certInfo($commonName); |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
/** |
| 103 |
|
* Generate a certificate for a VPN client. |
|
@@ 110-119 (lines=10) @@
|
| 107 |
|
* @return array the certificate and key in array with keys 'cert', 'key', |
| 108 |
|
* 'valid_from' and 'valid_to' |
| 109 |
|
*/ |
| 110 |
|
public function clientCert($commonName) |
| 111 |
|
{ |
| 112 |
|
if ($this->hasCert($commonName)) { |
| 113 |
|
throw new CaException(sprintf('certificate with commonName "%s" already exists', $commonName)); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
$this->execEasyRsa(['build-client-full', $commonName, 'nopass']); |
| 117 |
|
|
| 118 |
|
return $this->certInfo($commonName); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
private function certInfo($commonName) |
| 122 |
|
{ |