Add ability to set custom key length

This commit is contained in:
Rob Desilets
2022-02-10 15:05:18 -06:00
parent c25ba7fab9
commit bd83867dcf
2 changed files with 29 additions and 24 deletions

View File

@@ -51,11 +51,11 @@ class Helper
*
* @return string
*/
public static function getNewKey(): string
public static function getNewKey(int $keyLength): string
{
$key = openssl_pkey_new([
'private_key_bits' => 2048,
'private_key_bits' => $keyLength,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
]);
openssl_pkey_export($key, $pem);