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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIA1ruWeG5Y7ECAggA
MBQGCCqGSIb3DQMHBAheLsuMTjopOQSCBMhDPUht56vwH91wPB6eqy9Mt/slQOgV
ds4Ycxvo89t6jKq8q3flvX0lDqB0AnGRCH9NHtU1rooLrlhvCs9hHELYpVuOzxNK
EFfPVRHljFLHEddgKqEkksX5GYFtVpXul4Sn1OhQ7ar1KQCI5OgDxSmeSA2addd8
BDGChEvlVPFRKmDV4s6suN57R2Mzd/r2IO/bH5tThWJXDev2mda9wT5JsjhJcIFJ
vPSnMZtg7m6Wt5ljNmKv2ddKix6N+VRssNQML0GY15sPWG/d4HPyv0vAcf0iowzc
zdDhE7n57lN9wxbLpyy6SntX4SaA1ILwD1UmMV7AhxoZFDtyTu8F+r0yQRrWJ4Gm
HJ9lAf6rZtLU29YiCs1x1MHocORhH1fSkd9H0XkfyDJtgXCkM51V2O3rYLChBGwJ
KpxxajRkwyo4/aP3kfvNbrhmNjQeyHgHhp/fiEoP/p/sh2fnFn6B11KjsHjowTyX
pJ395B52IVsHBjD5RcbqAgDHUESxghsZcgPZz1q8HPnKrEyIK8UdPwvEDMU6//9J
glPgOYXqg+wlb5i1OhTkWJOP7V1ggnpXaYmTYqQPV0JJCJ5q4KqFUK6/fvXX9ly/
Asym3cR+FJCfrEf5GAxjQ34EWft9oSdFe1mmvZiK9XyoQHyg6a4VyAoFccfybPQj
S8INP5XW3udGjnZVa3H6WLn7yeqaWmsAd0k9spGC8njFAUbDG4d7KszgmXPUtV3U
icyHJZ05wV9FroUPZhx6I6k+CiffhYRO8ext+hr3QNGy3lDsxVgiOI57DiAI95le
BgEicGIEyjn5Uu6EimxgjuR32emYVYJBZRoswTYsCBC7Bqx23tyeWjcRTU2eLqsN
FMZRFwMMccH3HxijXL3E1yAeZX+KjUrOLkpza8ZZRM96TMk1y8kuXH9SCW4XDlWT
FVU2UN+4tWFtI8cCdbdJtU61bxePLZqMZfcU6HYc4NHg7nDjpYTYvhBHhc42+DWm
v6aW2G7jnDVN5l1fNgbUXT9+DcUGUeAV1Fyapg6gn9LZMBSqe7qlYiC3QAyzuBMM
YOVnI2AlT4K1rIhmLtx1JrbpsQbTS1dYj2V4ovvrfpJbrVDk9h/IfCDVGM0yt8l5
yuTO27VUvjsuksTq3lD4Iyjd7ra38AJU7oeoAQBFmpHSKYNWGiVr1s9v64f/sIYF
+akAdWHqizHA24vGNTWdXrsVT+tu0swsZ2ynu0rQvq2bRynFc5eJ2Opv9LiUiRdH
LxSJpQYoFUgD9vEDz4xG4LtVe4tor+xs15EszvHIS2xohDvBxypaZnu1KgTUXh3u
A+3pHSdeBn1nd0vVsSlosN0dIqwNVvw7Au18XPrdT5VTnOYMFib29KWZf3LUSjVS
ArE2i107x2wpCrNJ0btJF6oZLY1+aJ2DFSvrMHFTNCAXjQY/8qL/1C+bvVgsqq5j
FXT12SDz+JhJEp1/JjSgLwZNLMMK4gTyrmp0N3oX8uk+QQc/2BUZ1X8IYjXyhkp5
j6ZFRLmf7nC0Ll0t5LYGFva0/IOtoDo3itSs3tNatrSROGGbvCnKVKixlN2EKRH7
wMR+hBax94Kxr8mpCBygoO2d0eqNQAOTXgpuV5Z0N+VVpTwEnRt5gRP9WFN7fTZ1
urw=
-----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