Generating public
and private
keys with openssl
. However the code generates a very long keys and these can't be used in authenticating an API.
$config = array(
"digest_alg" => "sha512",
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);
$res = openssl_pkey_new($config);
openssl_pkey_export($res, $privKey);
print_r($privKey);
$pubKey = openssl_pkey_get_details($res);
$pubKey = $pubKey["key"];
print_r($pubKey);
Is there a way to generate a 60 char private key? And a 20 char public key which are unique with this technique?