mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
OpenVPN export, add ca's in export_pkcs12() for https://github.com/opnsense/core/issues/2787
This commit is contained in:
parent
f7dce2da6b
commit
53b43e7397
@ -49,14 +49,20 @@ abstract class BaseExporter
|
||||
* @param string $crt X.509 certificate
|
||||
* @param string $prv PEM formatted private key
|
||||
* @param string $pass password
|
||||
* @param array|null $cas list of CA-certificates
|
||||
* @return string pkcs12
|
||||
*/
|
||||
protected function export_pkcs12($crt, $prv, $pass="")
|
||||
protected function export_pkcs12($crt, $prv, $pass="", $cas=null)
|
||||
{
|
||||
$p12 = null;
|
||||
$crt = openssl_x509_read($crt);
|
||||
$prv = openssl_get_privatekey($prv);
|
||||
openssl_pkcs12_export($crt, $p12, $prv, $pass);
|
||||
if ($cas !== null) {
|
||||
$args = [
|
||||
'extracerts' => $cas
|
||||
];
|
||||
}
|
||||
openssl_pkcs12_export($crt, $p12, $prv, $pass, $args);
|
||||
return $p12;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user