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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQImbmBXF3AEpcCAggA
MBQGCCqGSIb3DQMHBAjpvflrn7kW2QSCBMhy9mLW/cU64UtJOO+pF63Autdb/0w/
BbM6iHpa7Fzl0nTzV6ZxX9ER5K1H5I8z14KOfWi7WAp9lfd8YVs16nET/huCAq8z
mWc/izDwgBNqsiz2lS3EzHUUY9hjQH9RRVPke3Zq642j20by6CDCzECaJR+rnVBB
FOe9BWHLQRd+ThU5xfqjWnP4unpoiRTBy3eL//CTISmsxWvit+R3BsmYanbYfgim
xwwjFZIXnkDVSvXEYt74j1QPt0LDhWxjDh4zupv/7Rjdonr32I2/W+Taf1AUCyBL
UUGQerzXqYbzNB+m1Q0qZq6SwE8/4M7zYiiwuMVdmx1ggJyBCVWaSfavVgg8dtqn
xv8iEIx64TSOOR8pBJy714wRmhH9hh8VX3Z+y8F3krpo5t3M4GLV/vtAABUQOQu3
MfHtmzzCbwevrA6OMwi+B0P0fHQiAUSPKkzXPO4y8ZFVN1pDNuu/9JizFMh7Y1i1
axCKQd5yYXRuVZSfJFpaGUF5vWLFvejKx6un985LbszWYGf+sNH+WwJJpme9xBPU
Ld+9X8zusLj2o0y6iurOqP6XZXquWyPRf+A4F+5P7xv31Bt2EL5xtOe2yZQenJ2x
ShRuTeElHHZhHUVU6PsOHYWTMcvNcVL/aqDS51jypFJk30bH8eLk3fAPQJULsFWV
OAc6WTmkepLHDsG1SOVXIceIOdDlXi64HMBEhgMhqILWKhEx1OqdNCKU2SrWv52v
+m477sGZY+Q1SRVqQmU6DuHdAbFOmcugOp26uMMPNVqyPaQVZpUd/3X6jvGuum2l
FJSwb9efoXIdZKMH7hQVfrOZHnU/IgiZAWJlcq7xpMktwk5uY89/x2hrX+tVA5vk
NQHlCV0apuxOXTzcbKeujrm+wwmpcuuEUKOU2jod28HQ0BJySR9ydZ8J8zpbsixb
jHOqNesHD/0MYSY3a9mlml/EvMJSFoDonX8CXIVr4UaFKTWczsca3UXtGy6NGRwU
ngSP1UJHQUEqKE4Yk+aN7SyB2oGNfx0zrEVZDCVDc2KDIqlVTtvQA7iGFWJ7Z9LQ
4HGBon9E6vv+7dRmRAC+gcJ4FdxF6JEb9BijMN+rQ7g+LMcgLZX96L3ljr13XGR9
zIUFRqbe9e80rdLEZZIovwcrG5+URP0QEZKhihz9iuDgDHNQuI9Tl5UhrYxIrT9W
acMZ9+hny7gYdiNrrXSmLEKMSWZLYTM8reBTlTWdROUJuLgt9uR7qSZPDNvvrWVT
L5uMnZWpWGlyPMrMpH+64kAaYhjc1IYzPgqacdaf2MlfvbQOTJZjgRmDpmgLprOG
NGj8O+gNurhpY8v5kaO+OEhZQZAgLrgP/mIrZg1WF51Axxvd91N9lokaKYp7DYJj
dP5eZo82gDZ5HtAzdbxo/viK/zM8ptbAXsG/NRdoSPw9Xhf5A36LfxJ49qbA1RZm
399oCXmLoBKra22WFqoDiiWf+owxqROyM9Oa8dDbfPOo++Mov7V6ZFLNKEAQMuJd
ZVo1lHXHJc1flwtJUGhO3ON0PM/96qLdUZVbporHA+BGEQ2XfOj8pQ22XGW3vx8W
RFEqvUiXPptMmTqhJZUT8QEtfdkcapuENsPGl2VDQGKDBDnCJZEiLZp4x/mGYh4y
Ccw=
-----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