VPN/IPSEC/Key Pairs - fix RSA keypair generation, closes https://github.com/opnsense/core/issues/6638

This commit is contained in:
Ad Schellevis 2023-07-11 13:29:04 +02:00
parent 1a869f6cfd
commit c5580da6c9

View File

@ -129,7 +129,7 @@ class KeyPairsController extends ApiMutableModelControllerBase
return ['status' => 'failed', 'message' => sprintf('invalid key size %s', $size)];
}
$attrs['private_key_type'] = OPENSSL_KEYTYPE_RSA;
$attrs['private_key_bits'] = !empty($size) ? $size : 2048;
$attrs['private_key_bits'] = !empty($size) ? intval($size) : 2048;
} elseif ($type == 'ecdsa') {
if (!empty($size) && !in_array($size, ['256', '384', '521'])) {
return ['status' => 'failed', 'message' => sprintf('invalid key size %s', $size)];