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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIsNR1Hzb3KWgCAggA
MBQGCCqGSIb3DQMHBAjPam6yXTlI9QSCBMhoY9Hqja9c7yxeggdNPCrqAKDA2cjd
mEpe0yoncj8Ykf+i/UEra6NvmeFkw8nyTp4k1gWeNYQFB/vpjUtYbEvIhZtqeGSb
cG1J6mKCrkw7nnL/hIdVo9pGKwyuj+j3xGup1usTa/yapnm50WF1lT/GuaKJrSKx
11ZP+McFoZN+B3oVXdBJa4NsF+kwZ7BgKa/QUQ2aP5lTdOW4EeBDPPmOQ5auUYQV
INepyXubNHq7mtwc3sz6yAqlfMEWaOHWytFlHRo+A+Q4RQQ3jc8PFx4xGb7yusTL
26BTiTgxfyWFnxovCcLxVxAFcMH5oGhdmXQ9CG8PhLmDQEoTKT+K1QU3M2YBMwgK
AGohd4LAyNTQ39GXnEP4w5Vri3blcBoz6s/okyhLY3S8BFDWqG6b3bwmjUquGXAz
/VPB5WLWmzTzEpFCIV+3FVELWI3rjLKiZveHS/29XM/nbrItKdijfFJAv9xo5kqE
EGSL9coymPl5lUn9t9eUQHJUtp1cUbi9tskfvF3Y9y9p6kdmFuqWle1mt09Woegz
TOhbr+ofa7H/0a1Ku8pB1Xz+fWUNvpwbmjqIj4iOxZHEfMvkovUesclNlb4VRzzu
4P+MSBE+b19hVy4L5sfQ255RREred7jIWax5KKc8TdFerUoPmINrYfiVz1ha1nXI
AWvWWOFOCiFao4wqwvqAXTotYG1ZrqOA26DvcKWtxkBsM/AoFyUH6KHNdgZztRo0
3IJvfsgLrdJZfD2NF9/a76vHqou0K/3rnGrgTp/M9DfF/Li7dM1zm8x4kJr8LEWV
zIoRvWz9ZBB4B1kzv3aHqNVmxSAmZCXd+oVXFO7xKq7Y2r5XOl5u/378cS9c03b1
gWgF2HgIHO4cxsxOjm1h57L0H5JrQrcpMXj+GqRYawDfv6kxklP65SumpV0UshPr
RzwSBwxMLZjEzvqXgv9ZzWJi+iFXHTzmT5uzG086cparf7Wpsi7Xos8abX911uF8
5Dv1RjIXqDSfp3/M4L25Jao+QRy6gk+BKDfhrS7K0lOzg2YArcPPCZLdMzxvMoEp
94dE2Ui1lOzqoF1A3A9oKflLzs84uplJlVujD0/DwckiVra3n1hJbqrSqfdkFeAz
yX18DK5Btgg9PJjcOfIbHpwmZ7AaECmbpDRsKTOVmlN+PkJqa2+svNo+oKW5OPw6
v99FEh5y8u/F5L8+RPPetBoidPWXDoaFEYhbqWW4h7QubLV3nhb1gNGJRzF6likt
fB/PuMsZUU3KT0QHUcQHSaTKGAI6v04L9Kqn9YduCv0Iahfc2rFIEdbTowGk3fwG
3TPjLGNoktspW56tNwSNJFJ7aj73L4rffWWbNPSb1Kb6XtZ8+YNcAsWR1MWPtiVl
PlVS9WC4+025EUBW4inLoefB4DVVm+vPiZPk6nGpEu8S1M0LQv4YC7+XdOmcEYP4
4i/lYSKWQUk+k8CLff1k74o3kMtOHeEdMMwRDBEgE8hVQMd2Q32pqNsnJMZJ9zSd
y26DIOKWthpgeCfsl+UeW+t55xXZNxgZwkGPKm2vSxphSrSeIa+ggNWfBSH6PkHo
Cv0PGZYg/xB/u07YIMY2IZWCwR8KBWYV4jCBBqEu48PA5fZp9HiaLkthAGY6JucG
2ks=
-----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