Display the drop-down list

openssl_pkey_export()

« openssl_get_publickey | openssl_pkey_get_details »
<?php
$key 
openssl_pkey_new(
    
 // [array $n_configargs]
);

$bool openssl_pkey_export (
    
// mixed $key
    
// string &$out
    
// [string $passphrase]
    
  // [array $configargs]
);
?>
Result
$out = '-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIMhZ6BtRTqOACAggA
MBQGCCqGSIb3DQMHBAi8qtkuFTvMUgSCBMhRCjrwQruf2DG4z6r5yCq6pVssV07J
x39oc6wFKYoGRdq1yH7oTnP/iAXsiIXoUzyS+AxNuFofvt0/Q50NfXXqEEngbjyF
zwEqLFPNjmq1MsK0+qwgtsozJgFeNjaD04sCvXRViCQPMr+J77FoIxL7dg6uVs9O
z3Nwwf6SIu7ATTq6p4HmOaG0alg/F9YxEddqpqJ8zXGjzqAVF9CbUXPzkTFL6Dv6
QZA84RfXoZo2BX4O13KPu+XSAwUi57qr+CUjFK0anR61KBKhrs6pvH2dCXyOcXQu
yh/Ny2ZveejJiAyYj4ZQs0SUoSWIdwqt4pL9Jv2FQIo2xo8tsN5JCgJu2sZuQTsD
sLdYR88IDqaIXD9StMxP2XTEXgamoS+dUtiy0siPgPDnT9uQs5ZlXqCkOhPML0Tj
YXtz3VK7cHvzDxVR2DvXlZOIfZj3QMHyId6RkaBtBjLOIc7oTLAfoK+d3+neMNrg
WQDFlHTn+zlUpHMHCyWll44BSz0xwDKjXXPPx/HHo/+SSb+3yAl+0YV5x4pdtosH
y8N3ElPLur/hSt41Y4Db8L18YxxAKN3Mr3VBlrP829ruy7thLXrRXzVLmQn3xevL
Wuhg6KrRW7QZLWY6oovh73eSn2iy1jTZIhEVwFRh6Q0pnN+n0W+BN9bT70eraPXC
ZVBcJYf402ljAof3DbVbgRmNyh7y9aqSytCtZd22tfxxkQg9Sjw+m1VZchpC/orJ
j/kxPcwq5un+TE+bXEFZTGDOxdcTlIKjtC/ELvGPwvgdpfAk11PpKdojqPxpWj14
d6cO6uSFepDuIKHB7OZQNx/MIHJjzGAUiNto3s0bXB5SLYvpjmvWE/HpKwOawn8i
VdvX0YiyHhuJdipGFp3A4jiGcioTgXzWFxaW1h7omiPr2zOnAPU/Kou3G3aVAlOn
VcwEes4c65WXyPCXGiHwl2ZPM8x3fUUmzwwzChimjdYqoVZ4gSBf5EARYaXoFqhn
PHw34d8bSxto41fElmGT60x1wcDUo9MA3zt+Df40W0lvJAodt/VrZLLEv+hlGYZF
HKYz5YAqOYRiGZwSFnXqGbjrK8wsCx9W8Bt0+0rV+9xI0YaCwm0CFy05Yi7qrAjx
A9qm//0jPaDGErpZgJmSZZrT94ERHkLrwip5uxtB7VxTTBsnWPrBj7xKmwx2o8pd
odzER/G0Lv6kDw+oAGkz7P9VZRJfKemMSIxtCxULwK8uz/8v+BWW6Fy4GRDlwwav
B5O6rkcZVek5Vl0HCrPdjvlKxHJNofyEFWttpxqWM6G5m3pneQcaE/nKZyOOOtgy
vA+pu59sj/Fwd73+vPPrXA4A19QXkiRXhKonit7WyNxoLhU7GEALEanTgjAz538l
KDUxjm7E974MNHoRv/6+zm6rY6/rxcNkOnO59nHLGztTBBRB7Hybfb9pOIcNDJnj
L5TyX0q0IM36VmYY0RnALENKvxkwCRxVYrF2IOxE4B28v95QaFquOSCz2LtgGu/r
uBX/kjH7KXdJAbSD1/fS65kvgdZnX/Nt1kvIj9mOih6SW8cjEBAEJoeyYpTLPl8L
Ne1M/m99eJPP16IINRKMGqqHIECCgEgUjSH0UE6ZszV/c2mydrEsNjPK9mQlyOjn
RzM=
-----END ENCRYPTED PRIVATE KEY-----
'
$bool = true
Examples
#1 openssl_pkey_export  ($key,
 
$out,
 
"this is a passphrase")
#2 openssl_pkey_export  (/* $n_configargs = ["digest_alg" => "sha512", "private_key_bits" => 4096, "private_key_type" => OPENSSL_KEYTYPE_RSA] */
 
$key,
 
$out)
See also
openssl_pkey_new