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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQINsTDtjR/w8oCAggA
MBQGCCqGSIb3DQMHBAgbtmO11GX2ggSCBMiAhrwMYvGgNOg1Slye+JeIv5KIQvUu
t1oNvP1oLzgUASFL95Id3mmhSace58F/XUPnM2g4gUkvjj8uHi9RaL2EPSO08jqn
FfqdpoEleH1i5uI2QBewZG4d3KyyCJ4Gby86gVifCsYWKum5dLjBQfStO3eDKKkm
8LpD0D2KFkwGyFnNiMv2xGlPGomt4zm+3IfMG07m8SMqJrNlnrxV291EQFSge63S
QR+oDozIWAUZUg79mcfTU177n/lWJRb8dJ93c3faNP5Honx1mWg5y9f72VYvJ9g9
KNIIMcH0M+yDEDPVUPz/jw2FLIUzeEouXiN2jU/0gabmiPxlCgzukp7YVJ4sAVNt
27t7vVKuPNMWcNky9Ei6hI8lEkGXpQ0W5ZrEiWa/grRDEPdt9j2FVTvo3EqGvIBL
Dr+oPgl+LFqskW+PlpuQ7ZI+Iu5zrguMfTEbHvGEHaihKgnNMIyHFAW8jsZqEDUV
ddmtzP28oFOdf59Jku3Rs+aNf2QaM6/8VRJd8s3TIBDDRZCZ643QU81WJzyEK2x9
LqaPRYwc9UFo3j0xWnPqQPLCmzZ6eORJZamsCrVlKNXt186Tpdc4Uc9UILE2nYN+
KHN8q0HnbSebpIkYbK7ukb3GEQit45ErCPWfgTw8qs4F+7+RqVQxAiRHt1jSgwgk
AnLadMONNABJK8SzyxTdhfnZA8JSgeDXArgyOqSuKkLnkR3d8rRgCck26KHvT0q8
Mroo2KGJ9FD6I7Kp3NnSwePcv69w42TfqWfKsuyoMh1a6eLFX6zgaFc6QsRNkSn0
FJSJQFu8+oN9xbMH1Az8Ph2NjK+msX0MdRn+HaxyssyykPhE4kbBANGgTaveGB9f
s+hBWVmbqyIaU3t55b+uaKqGD53QQbP19XNsTSb4na1uU6siQcw1eUAGbo9V6Ac0
9WFcrmbDb/KbdZ4sNpYDw+vKoOfdOfhrVkxh9hdQtKgNc81lRvD8JnA0fQ8aPf7/
F0s5GCBWt0/KC5aksyKftO0aKO8uh4QxGfawLiiO9/AL1fHiayqZMW4d6AThxIyE
KC8bz2HoW4XY49AztR780R2igt09XuRQ4z1fNaGLprHYFjphVwl2ODAmw1+EHuED
bU3fXVtpDlPwk5fmEiIh96QIR96mHuOgSCvqsSaMr6OJSDOLTL2IOydj8wWeF0O+
os+NJDrSLWTKiNDVwB/p+Fmb2OpZhIgkj7jdq6Y1K5UobGsZdD1SbqDocsGdLuFU
3f+OBHXlyCLtthMR74ba94mWK+6uLIsits/ZJ8QqTKT6h4ff/YXehNmoDqeIpLve
5t4Tov3gyp9nBYdW9eMIN/hd3T/8tkxLrjEG+g5f6+IDoqyO7rv61DFOGnAdJiO6
dfDmoweEopFh63I+GdE9pRVZZNu3DJmEe8eUYtDrvjJGu+alHU2MtzO6MX9NAjfk
P8yyAEhDd72n7se6Vl6M8HEK5jiwlh6TXCoJ9KcG+tUoTf5oUcMdjhfU9cijRFCA
BVOb1yTJigyjE8XRWVdIy5OZ2boaHHl/ssVO5fWxa3bo9jJ4oDU4H0o9FJg+4Hiw
W4kjMhM4ZVF4jHNGBKWHNHwAS8w1ctK7GGwpcIVxod1LI2XjJeulaUbrurGR6PYr
wP8=
-----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