I want to make an 256 bit ECDSA
private key with secp256k1
curve by php.
I used this snippet:
$pk_Generate = openssl_pkey_new(array(
'private_key_bits' => 256,
'private_key_type' => OPENSSL_KEYTYPE_EC,
'curve_name' => 'secp256k1'
));
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
openssl_pkey_export($pk_Generate, $pk_Generate_Private);
var_dump($pk_Generate_Private); // show me NULL
but it give me this error:
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
also if this code works fine, it shows me private key in PEM
format but I want it in hex string format.
please guide me.