It is obvious to me that a 384bit RSA Key is tremendously insecure. There is a similar question regarding RSA: Why is keysize < 384 bits deemed too small for openssl_pkey_new()?
However, a 384bit EC key is currently seen as extremely secure. In my case, 384bit are too long which is why I'd like to use 256bit keys.
Why does the following code throw Warning: openssl_pkey_new(): private key length is too short; it needs to be at least 384 bits, not 256?
<?php
$config = array(
"private_key_type" => OPENSSL_KEYTYPE_EC,
"private_key_bits" => 256,
"curve_name" => "prime256v1"
);
// Create the private and public key
$res = openssl_pkey_new($config);
Am I doing something wrong or does openssl_pkey_new() really have the same requirements for RSA and EC?