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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIikze4mdxcYcCAggA
MBQGCCqGSIb3DQMHBAiXFtlzhUAjLgSCBMg9Nm9t5srw9ZGT81IB55XW3+Dn1Wo6
o68iGC8QaLKU5Xvc+RA0qEbxAdYViqSfGisLOOELpxn+bJvbtqeWOfWjgQgMcB9h
xBa4aTuyisFqFYVpxoORTF9++3c/eARWDAs2rmgmOIhV4MzVAg2AXFglwkY1SH7Z
pCIY7hn4jNSi7Vw0ZsTkDlksQiyiI3O3BMuI030UhWNE9giDKIsVookneFIozdZH
Vtywtk423Xdq2jN4D4dnjsyXnxcCDbPJoxLBh3/RpmV4hONm8m+6IQSi6z4PKyof
R7glRRDegkPQnzpnizr6qSZCw8eCFBErOvJNsBigbXZo9XGwG4DYABJOqHikdkcf
fleo78NY4C2s2czHhrlwDoCsYcC/qkm7ony2mNGxyZPQ9bILYEKTa88Yh3BN9pia
ZEa9kkdaeJ+o2ROKvz4WBzjZ1YPWGSsiRt4xF8/QD0xryJhW4dz/wlgl1EcDp/pr
bWhha4i6ES7xPg8ppZWJgXGflo33aAnzfc6p/WrQf7749VUuzwfm/6VM6dTwH70C
M9BDvVOpOWPZabSbIM/9w9+d8d/XzzGQ5frhGvOwjUPboVjb8DSdyXCZrdu2603u
axgQ+pB9x/1FbsfFrAqeKAyXXtYG74VMZEoZOzEW58LMvvF+bpZsRLs1d6FxO8H8
znsuBaM1WzHc4o4F8/qnhOMPiBGNsWmqd2HlHh79Xwquxw39HjIuoKyDov2GCQmd
zIc8y3d55Rm2UICKmgZX0r5lkSJ7wO5TEinVL6hHZqTaHJYzJqwAyqLtblgbsYMP
B4nJEkMPj/MH4i8+f53fcPgFxqRHFBr7SeWPf8VV1imH3qKYSolUCx8SWcp1qGG7
4w4eYfLa/9y8JynD/z0Yx+vgMrnj2sAKvt0SqWU7tKBQjgAWN2KhGxpVG/YeHnlh
Ry8D1DLrS5okhMVwUil3DNKDM0vPyTiaa2Vzk83HGmUAYB9Fh4IRgzt4iA8fpfFq
fbkCFCYeKqXm3MbgzaFBjrb+DrFCZ8hKUHTJdH6xUTxfCTK6zxaO3bz+Qa2CQ/jm
HaTOvvifKrGnee6KzmCZeNfJshhhUhXcMK8vYyigaP4bUkhdLHLIb2MzJCoS0Ib7
c7SRAEjNxonQHYyNKIUn6mynrlwZ+ndi5ByP62vRmyoYGYnoCeBs6VP8Wfahw4G+
tBo1cQa75xOnEf/HvC7DL8Ub3+rvuxRRCIPDQw8/MmiU0NCOqxPiabEUJDU7sWqo
TFP8QC/ne2vjMHvfse+LbnAK1I8lgZlFK/dEnk0auLDDNHN37wZKnQurc64TUVFZ
hLb+ND1YROihH5qrR6QXMLJrxBeUmUGRc6I0I1yvS6zcQPfzVX0HA8i4lbqMWGIC
gJM2zyWCGFhw1R+m5QlivqwnoIbA0RoKUuSU0/fvCgc2b5UVZqp1KI2zFtntDQXh
/UxJS1dYG2kKZuUNsJN24ZgdG6tINQzcgEXRqbphL+LjH2kOZKkl9qdTDSNzF5uL
hagO3fDG2MdMa/KEHFaBduDT15e4n3q3WKrYkP74Raisby+eTkDj4+urC7dEMz2s
ONgXTiS6ftw69HLEu8fQDNH+BB/DbXIRn8XCFdJgGp9ykM61XRYmoGD1bSDFjp21
Duk=
-----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