|
@@ 82-91 (lines=10) @@
|
| 79 |
|
* @return array the certificate, key in array with keys |
| 80 |
|
* 'cert', 'key', 'valid_from' and 'valid_to' |
| 81 |
|
*/ |
| 82 |
|
public function serverCert($commonName) |
| 83 |
|
{ |
| 84 |
|
if ($this->hasCert($commonName)) { |
| 85 |
|
throw new CaException(sprintf('certificate with commonName "%s" already exists', $commonName)); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
$this->execEasyRsa(['build-server-full', $commonName, 'nopass']); |
| 89 |
|
|
| 90 |
|
return $this->certInfo($commonName); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
/** |
| 94 |
|
* Generate a certificate for a VPN client. |
|
@@ 101-110 (lines=10) @@
|
| 98 |
|
* @return array the certificate and key in array with keys 'cert', 'key', |
| 99 |
|
* 'valid_from' and 'valid_to' |
| 100 |
|
*/ |
| 101 |
|
public function clientCert($commonName) |
| 102 |
|
{ |
| 103 |
|
if ($this->hasCert($commonName)) { |
| 104 |
|
throw new CaException(sprintf('certificate with commonName "%s" already exists', $commonName)); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
$this->execEasyRsa(['build-client-full', $commonName, 'nopass']); |
| 108 |
|
|
| 109 |
|
return $this->certInfo($commonName); |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
private function certInfo($commonName) |
| 113 |
|
{ |