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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIp7SShv0T/JoCAggA
MBQGCCqGSIb3DQMHBAgLWtqlCMaNFgSCBMi2ajh657LWIYwkvRh9+ZaLt0ei7eIP
COtDKzNTofe14if6iaWJ3eH8Z5rUeWWp0K65adXIwVy7Hj2Kx0sXwN6rELrP6iQ7
O26Cjk4o6DX3/YrkFfsdK/zzsSHa/m6MHmFVI2go0FqiVFkgDYHNjujNhRNQMgg1
m5pNuWCcy1WBXbmU7iZTM73OOYhr95kAGpHARcx2aN2o0kUCzWN4f5soqrIxYvmP
ypt6AXX09kNkNoBB+FILo4vppR8ihiFNm1R39bEM3lyAq8fcyGNav0v7VXwGUSl7
s8PV3QI2f5v4YPrq/9GMKIqziXz+dZzjvyrImOMZhDF9IOLw3hz5MX5dG7Wf1nRX
uwM5PxqeRX1EGOkRskm5FAtTEfwMr4InAxfISS+NY6e5N6AeGM//tAElSVmXPlq3
OZN98wEofYvTq/6wP/n/750B0YcRlgsYV7aoJVHNQOqnorgJsVATCsQVuSK8Q/wN
/NAPSHYq47II6auuEImyR6syjynYqRuFRTLTJ9fLa5xGj76QeevFo1B0WA94GcCX
YDtasLKe6jPmSZg3YhQlnDtPsKEp9hdHYHReqV6XRvUqP8gz3tZgJdhQU5Xzi+td
2njAHpzE1y13J8MeQQkFKCv2uuAPH+3nFdckdIfyQFTqw98j/TCCiLk0s1h8H3YA
d6zCAdGjqTr8s09W5QqfvEDzCPaLAviIZjdiExbzGzKsXBhOefq/sQ60/e11MuJ2
OLXEFQlEPeN0bB89vJkiBLw9MVa2glsoH/kz6uhPQMX9uDxky1MscBFJ9Sqw86pB
sNFRwRVYw0ZPQf0T7YCRuJynIidV0A4qKYLxZBGwyTvjxcmv+ehVycpw4eXYhxK3
jGGEGl92sveuVkbIfx+tvJEGLDnUdTG0qw0JP7HszMNFCAxwMILs6eWMwyAoSWds
SiCOOl71JpPCulP1p0ZTCh8mlIlEr6YXKDeWMi81urTZbaBxxahrXaQe02Dp8jWV
vUbWZShUd0ozjdPD2QLNXCzePywb3X+hVi/WeKw6ZNAUIiRcVcOgLDG/QnbVfXa3
2I3sbJWw6pN8goTepWGgVtSBcoc2jMyzGwrmDHavwGHxyHwUH3udR8WMBmXpGTjO
aNDen9r1+HPQifPHN8WpL8HV9a3CX2Yrv9A44ilGYpvIEFTZEyPEx9ib4f6uQnnx
hzf8M0Ppe1gpk/cLV1q8ctzbJz/051U8/6wxEH7w1tUUx4jgluP1h262QrbAOYYj
x9Xg+0HnrC3gypc39dTRw1dS7vTJOIeJS7CEmiQrepQvUv3xXmKt7mZnU2evYnN2
QxsgAXMh0P47dJ9N4V4FIGXS/nPpPKrWGJ7vs30D/hAn88fbj1EX0Xln0dX1SZHS
b5G9Q+IUOSmF9rih/WJs7zv037fMRr++jixYqyNn90DFO6B2Czjr2l/LRaG0zGnr
DtvY5K4paK4aIN9eo/iyThudskCB+eSKo5pkTSbru5N00FBBz5k8mhqUD5YDxFJz
fxgz5KEViIJwcUOz3Sl0BlVySIAfRyN1OExEESCNBodT9b01NP4syzL0GtabifBB
y0+PJ/N9FbuhRzA5U3xfpcDfoUhFIQ+0Fyj7QcnturvYhXNg9d0mBr1Djs0k5qsp
RuQ=
-----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