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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI8uN7dp0QFYwCAggA
MBQGCCqGSIb3DQMHBAjGmVHi7Q6R5wSCBMj0eBNQDVi9eGu8SskEOxqNmioAhQ1X
JYWv+5pYSrpZwMsEoiFc1lOzfgM2b3MXL7veop2m7RH3onjgbTBcjPSm5iDHDpK4
Sr2+4qPFgUm/dRtqc4eWTYu9mj8zA/DEZ/D4yDvKUKakMmLWqA9Y9JuPNCj/3sey
8Rxa/Y0v28KSjACzas5rJbTTIJ1IecrOkOFeXVucHLlJAO3Pn4V30SF70D3Z8wW4
bTrYQGMes8LJpwsMehm5Dsk1o4daQjHlV1cOya8L/qc2yEDA78kg8Lfy3Ix/QRtL
qda96Qyk6X/8icrhdOJ+vyFLWsKDmKcPVzNn6IV9JIxSi7eBRbXT47d3fz+HE4Wo
omULYNegX7yhPOckhfWOTdquxIQHUI4DCrHzXrgWd+4gt0Ww8qMOM9NurP8HDtzh
0SabgCkeEcHa+LRL03KKIULWB3S7vIUQQXCkItszVrAU5AnjL7n+yzQ3kFn1lgeq
BMk0d59ASPF7Nl3qj6manZU7MChwLSEMrYSxocAntjkzFx00jv9xAwJpI+EsHsMK
X6qebl82ktye4N0SXzPZCM5HJ4EYFDyDrGvcP+SYQ6U0JGij6HSDTHZROu0lRduB
zHh5mfsSj/pvs8y4SFNJkhOBaumhtQcrau0ul5g9tMWHk5rqTHfGmYuaSxIdApTy
vLbJMHCahUVFBipHeWaN8dM5HXZZ1CFwkabS+4qvhpJ6zUITaEtkozN2g/9hI2Dk
nRKskc++DjDv7zYePe5MuolmETEeoVgY6dYvHiMRFli5F3k+9T2njTfwxNNAe9fA
rtVoO1j+szfuCKCoIdwZOBQi15+RpdWWUPGulj1/zVAfb9EWrC9xuYP+SsswLNoB
LzVsqNq8UierRppWV6w9IX5aa8iS2iPUgtiHbMsQym4X8sG6WvpL9RVOrr9EZiuN
0LcwW6jiTk28/FkmeCKvUA02CF1MLiFrJ+8KMwObYRPdsTHgFNm0AMjKbgObQZQP
6CQ5DnB7nuo0HEb8k5JNvNKItQXYrrEAYW690OTwbhVMlbx1N50+kGgOGIHXptGB
laasQGVLGovlmAhRFPtMPxp88qdCGnY+IMZNzzyax06BuNI1bfQYJyrbKsreijDn
LJeqxfJtp7kbOf8vK/SPIsIJVzbEeJ3nIGTIdcg/OhiV6TZZRtdwCG8q63UfgD2U
OXOHR24AO4lCGOj94X8Hrvmi/RTRCq6VdQvOI1UdeSonSNjRwKC2sH17KFG4L9Vf
14o5QM+hvpYuMeZQl5YD/fl+v2c3fKKFNCfqCC7etcpMheCXig8T/5FhWIdaP7Ul
8adlncsQDp8KkfwrkMGzRJe58NF02mC90lHov6hMbcBRzhtIMom+T7Q+FUSmE1vf
PRgPVWVCr6qYezuspeWfybEGfUMWEXG7jHbIu34eY4GIqX93+1iHCNRBCdE1pq2J
fHPSG2u152P+aI7w1F2KEoz/NRl1EMobQI55IBEGcrHvrDmYbmL+CVvtbdIydt/3
o0JxxE69q66DlnCXxzyyOUaeqMf+iC80Ju36Qho758G/Rp/gwJPnC9pkYekLEDo4
96qxp/M5hjs9slDYrI26x6vhB4Br0skUFE6+HG9DfDhym46LGE0pdG8w9z/+18bg
6Qs=
-----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