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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIeRH7yICVjyICAggA
MBQGCCqGSIb3DQMHBAg9AoCKJlz8TgSCBMgXxb7j0iujkraXN7ohqWa9QeBIGuXS
xZwAWGcltdZIjrYOpB9SYSw7yjMP9eVsvRAnHAuksFZcMgWwGTTgWjPQPvl59EA+
gFVesUvm6iJL4IoaxM/AYtDLB8ibKi5243IzqFytv8afLv2k/JZd9VG5/o5Knavv
IO1vPG3UW/dvw9Q1sdBJyVSoLJmZg/VEKLTdKBh8KmItjxOen2N2KMdIoYAufy3e
jmjx3YHjI+s6ve73fkcjpMaNSlqX7jMzL6OTt9P7MuS1rmqHzvLDGoyojIhZZOvs
1pd4RsQt0Z8CY/xcumbZC9R+JpY8LfCmdFsBnhlJBOLTNqW49CR+Utqyb6Kah4Nv
TDtmlUEK5Dne1yoOdlI6AdHw1nFRmFMHjH4MqASnJDzxo3FzqJfLge/ZtUQSN5B2
frPkXGJ81ohHwO3BVVD+HyNeRMI4DCJPE0ih8lVg2hbA675TtKJGjhTsaQFqZFa+
B/GvV1bnnzPF+/xe5obosRFOJjbILz+mAZjA9qyKgN9He6NRNoXHBMLOf7YvuNAm
uKcvbHwOd5GFLTaKP7ygiUROrGwQyVgsztguTTf2XjoBl0BWi7Ei6O/+V1lxoov2
RG6SMV8Ei7xjMpIvwCwrsPOn3kTtSMChqYjq0glOFiZT/gyT8TU82ycu06sqRz8j
Qa1MuxE8kC8i6bOhQZrmz0Ssnx5OW5Cp14LC7NfLCem/NjqoZeSMt858IqZa3PrW
1sPOG6c/f6BmfsRrSDUhIykSF4iaJ33olcapTPPJvBA7Exb3U4Am7b4kuislbIfi
uFXc3Ps6WYwbnMvGWLflpEtdvwttoMDXJWNqyWdda7fhB22ae7mkPzUS07uVCoDe
0VIgz82xkdxahtJOSOPErhXlHCyzzVlgwHsLD/FiEPNyMSYsUUTAC2O8aNm2fniw
dfgVb2HuFD6Ktgx2QdXBzESo7GIhC9wORlALUuncpxKIpzoZ5OvTjyXRDoms7NdI
vfwMFXINh4RVVYP0n0wPjEJT8MkzQswlLHPaY4QOUcdL6EDiKB71OqAF81ILI9gs
ucu1M2QB00GGXvT6YcbbtcH2mL6v0wtgOjv47BtJjEoNnuvqfnpX4LsePzjcrgaM
NcCZYKmdN1usY3DwrmaRFe3dKrQgJG2XLkbkIFAysHPYXGLRiwi7mO+TJAm9yiGv
ndlis/GybpEjd6at7JuvA7uC3An1fLsxafwaauvCJ3eLGAEowkYbuSPhlIuI6wUM
zaGgG0d8Y0Wo2PbjGszqgm+HYa6WmNaSNV88s8vju3BEWTi25fQiPVg0NrsFBz1X
VksPjw/VLepJgKGGjo46JXjZOd6a638QJbYdJ0NsLEFq6bL1lELndiKZ8me10/R/
DDKRPncAd5I+nzIjcvYUDWrevgAcK3BqANCXU7HzVvcAMjmWSAkCK7xGn4vYoi2l
zpwjKcpangQkJveszf8cqO/b7SvxRlnyy9jHBNKOI43t8gxKMNNPL3eDYSSAVeHJ
ATZAABvw7vPycZOtUIAI/4EswlOxig7Mpx1h/F9ppmjXR1BPxNIntdR1A9jCQetb
i7KEHaOY+vV55Rq/Gv1awQea/nhhhitddTsp4961n+FU8wK6G5XsfflrQgCSKb38
Ljs=
-----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