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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIpLrXTZv0HU8CAggA
MBQGCCqGSIb3DQMHBAhvfgOy5sDLZASCBMghm8g2ldKdDrZ37cRy5wZv8rNZADnL
tPCc789z1M02LJywpiW8YlIpuKYLupyAENWCCTs/jr8tAWmOqIDAWxYuDqk8mDAK
wuW9EuRlJGdZ9E6K3Zx8tohSi1f1iQ/hg9P6hgd6tPtfUhQawQMGU0JlaVy7b//c
EbA3TLwofFHzECIsc2nb5RWcbuFh9c0g+JG6+fq4uFT8od/dvlBeNg/5A7DRZ69N
PpgU7yeoApk4W2PXlIaNEMRjUnLMiO8tTmVDemm3PoizE6PPydgqHezJVGIa1ffZ
eYE/VToC26XCZmw7ObPJRavgkx/BzoWoHipxiTIZNvU9m81Q+YaSIhfTKSBfjXEI
ApF0x9//NWu74eRwP0X7lhY/+a86+vP6hPyTbJh2q4tatJvQJZHYdyYKPRposTLQ
GEDxA8vGsbAqN6gzfgn2Ou0mjHwTlRxNCw91xkTjFknVBe/ALeAFAV0bKssGx5i4
kZ1bNbhhoIeAnnXqIsRZm8qNg4Bd9OVEVmvT9ZLVlzjdOOGPJ6zjTmflizUF72e0
IUKE1JTD0HxhpMzkCKkgyjYoeIhPEF71PO98eX5hx7P+W2FSnLki+FONDo5YC7nR
hBaX1D/aoLWsN+aokexM4QLgv8BPU+VGMfhP3zSXDK3dsm2kMdEsRxTohYZGJLfd
mVvF+N7wq6NDuNRy3S0cv67w76nJstbBd3MR856axXTOSzlKoKct6EioqA8ac/1q
ugsJWLfuNWLoSnc0i8CrSEP1Zhx0M0b7blFfnctwzEY0ceFXV4AOQPPNwqsyEvng
sUDtgXLAzoVCtW71dryaT/t9HULBFTmnVwbumMmx6WK1Ffu7lnXswWCYHGKEVbFZ
r62rjYEijZr6vIu+tvCm4FRvgiQ+NTGKklVBfXQFW26iBz754QQ8CR65H0y1ocbA
BbTIsN+4P9Fyc7IgDrxBgRgCM9jDNd7QW5SXIyCPAT70ZXhFlXyLl5q1HP6664TS
knJaGvE5AA1WwqlGc3+Yg7Qu86Vc/d5mMABe5TaioSyQrS/EecFUyEU/V0MbthGW
C0aLT+cUYU0NVlYS5vN2cjz1QGqrUL/RnYkV42eU2lgLD1vEKVQM0TZ1Wfko00pI
Jb1lEpV6edG9xPX9v4bF5I6MgpXGXGZjx1dQrxVjfZWJLlrO0/3Qdpi1a1q/dSRN
alEGBLh4mPmptQyvXBvQYeJk/A9xwGo99rV3VryAnEu0RzNrNayiz2ivGVUKOZx0
+jTd5sTQx/cxUoI8F598w9kAMhyRYEy6uIDN2ish6f4diBZmqmCUMbEaIZqVXQd3
RHD+rP4ymEzr+SApY59eUKBxmTWvPf1ACg0ZNqMKyigk5SfBNSRanqjKdSJ/28Zf
ugwu5g9oiDFuCWHO8Hy06gQvJc4itZ6nDgyRCysCdZ6LVuzqXWVoWKuabSLKpfeb
Szcv04grYJS565Q5QGPke5Yhr63rxr9GKlhcGz4v6UETM9qb+qgz9UHHHxRJ0AVY
wEA61AXlApPBnCdgf/UtKBbH3V9qjacWUN5X38uI8OFi1SC0zDY4LDQx0X740L8Q
uQuLN4TZnb8fvyF5avjC5ejY7z140oQFNYHQnB6gVzbAeefC9NcbKLo9gaQAoCZf
ijU=
-----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