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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIuJIfRNQUtYgCAggA
MBQGCCqGSIb3DQMHBAhxWlbQtrO4mgSCBMhmUhDEo9SD1mgdzxZR2UfrJDUzloBA
KqD0TJ5cSeN5aj8gyivV406GXvoqEM9cnDd0iEhIKLZ4AxZTldBPQi3QKbE4bjBF
Dry3rkSPljFVXAyWAQhkKppAPzpwvibKPEeXOcRUDTTqePg6GQs9f7uisM6Vm6P+
d8hPPpRQvfC3qzpTtUXYMel8q4WuCLAZSJQ4xKpKEtcvVGuprd3FvHe/n3l0V7H3
DrK8bvfEiM87bJe5gJ8P8V3ZeP8Flf20dTsFXl+gcgBpou44DuSmG2A91EnLF5Sp
+3qY5P9pKL3PUTThShUyeKiRM3FwR6Ubl7LkkvfFGjgSuy3AJ855hvxnhCDk8u5I
l8lW5YIaVbO5+YdiK16awl2RRP0KGIaCTLXQP/xml3sXEPUPXd5bQMpmLf4Kb7n+
ZgZbLBwZG7R1MoGROu5MG0zh2H+mVmRaTZc9ELE/QX02GMfD0/3C4DxGEyIDCzhi
xIh2794vY1I/WL9yspbRi2kEphnlzr0eueH8MHL0iFudnqSJ8ftkwS6eF7smK1Hj
yImrvvUWYfbc05/qFNB4RneYNR5jnDYl2AQUZhtAjMrOXuDoLC1X8PAitSCRPCK9
jAeeYQcvJODW3DBofhagOe/OGqm82fWKuabp42+HEFM1AIUHDb1aPwFp7c2gDy1N
P/WuhdFQk2zuMMoes4CLzhK3shpBkDap3YAa5Gfu58FaIybZpL8trRuwq+5SfrFZ
TtuTuq3dsI/yVGL6aCwiMTOXChujmhUyCesOioSEOxr1ooHy0TO/NvZPht0dyt7p
mgMcvqTFk+l9csKBwGhng9qGd/zteDY5mFjfsS+2+KHnrNup1hp0pXS6bqmVqyjF
hsiTReevVqFtU6a4SDlg/GmKhbdAh7+W/IHkkuPVVDMEOAtPiRsQDpGGUfw8HYuk
L03Xkg3LNdc2+h/SVH2y/V66ljmkCEhXYq/JzZTFx2zRXCX5szkagWaiNX7VAYd+
zoKFSnpoQ3Te5KtIIJGWuNNFMqYiCK3j8yZa4KoHM+DSfW1qL56MO6ZXiVZ5I2o4
yp9I1+3BxCJx9RZRgEBhmdigmPI24isB1V2ClwmOTQ4MBIqWOP/W2VxuiO0aoks2
m0P1mGk4hFVc4cqKX4woabAynDSrX3asbMc/8RE0ejUkpNgqMAxD5x5uE1SUwfKG
vdL+JcgqwfHeXShQFJU0v1/f07rtqRaYZqQMH8WP5GIk/1YBgkkhHq//BlJx2HNc
w9wMHzyJ0hRAE3DZB+SAfKOYb/YPi3D4c4M29lO1+YmnU1f6xKEjmOt7HC0v3oXe
Hzzhfi3arbKV2YG5OufiJABp/VHt8Hz5rXUa1UljyzgNYjCsQYdR0XDedNO1oTIw
pzMwJAyali+06gTPN5YQPI/ZTi2hWHydrd7j5sxkj4CZ5EEuoIipl4OB8BI1G+n1
RZdQ2Mx8/fORpvmsNkYrN/xQ1gJJpVuGgN6OPJVbM7bw9WwSqJGQo8UvgGQC1nLR
obqvsSAmXrJaVX3M2DHCFXn0Xkf/VRL3pg7fwXIswrPUpu84knqyHs1OM2L4iRtQ
kGdea4RRq1aVleEJDT2bXC5VguWNBSuIR4sHURDwP/HJA6itvvzcRQV4YWPVbff5
DH4=
-----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