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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI5mHZJwYognsCAggA
MBQGCCqGSIb3DQMHBAg/ldfboav2qASCBMjuQKuEBeuz6vk3DBcoWfMI765pSPbp
5MkyF0ezFEfc7njtBnRiHenesRhbG/l31fbFKEYssrEwi4gHL9FlqmkIhk+x28dk
e4GKEOkObbfRwmp3ggpATuT04FROvlVRm0iuVOq6T0DQt4al4jrfDDGxRRu14aLb
Ml9Y07grplPFfuLDFJpfCaJZlOWmvq2/z1MPVL4dLPg96RJTLQcl3PZjtdB4iyk4
BPOPXGnQvprVdKVM33pjP3AKrdZpCW53QFsS9iqjmpZSqzXfnl7vcPg3v5UHmhqe
z0YSamqw3SyLoZvADeipdC0KnfWFhO6L5ODmGl3dpT6xmHq6dnd9Yi7RNE+s7E8I
yKUKz3KYAp5aMxU4KUuXtGZrkyYGacSts68bkSKWB3v8KqTwTG0THVltFs5TCENw
99OXekoZXfYlw+QUocj+oeonAXmiUJYev5Le7qVXHGpHkr3ZuvyGDK3CYt2uxgeV
ySxAuyN5voORufHpMRLoTJm5vmf8iDbj/1oTam4F6VZivTVHaaHwA09uMK0mlGeq
yJ4OBVFlhTa8aMOBrzQKURa/ljmZxFU9CTIKCXwmzhtWdYNLiEJ3J2tpRsIVzyYy
hc/u/NbGjpQ9c0JzlWXYNjBw/b6N1g95924xD0fI6uIm+tFuwi/y9brF40nFMaFU
W6mRVNXNRMJGgM0Dh35x9iGz0Ct1m31MIdqvfl1fintaDsgpwl4AaIRqtGyPx91E
9Rg33Yx60FXvqQdC+djWu9mUbNcqjFOTigY6knbcO+EFlLMBUSyo8zkXApzMGnKO
o7LufAlRlP94pcEunn43W5H1xlpjxALRi3zmqYJCNV3HfRlSlUybdrH8IeKpjti6
O+RtgbdlUNUt6VpgF00wI9wJ4vbDqPkZ513Wq8Z2EU13Ek0IJ/Cr7Utn67FvHE08
DCizZqBpphnSPgYkYaiGayI9+Jt8sJIHsZ3h9Sz8pzb3c+pSG47CspEeyljgwfIB
GcecQxT/EIB3qYphjTlzI7ynWBsD5ZkIGkv8R3Tn3h0NgxbPGHpGVbSQVPwnHvhh
dxpkeQF5C21VYE6TiU07ixXoF+Oq3kkVkj/UORkUIApgAyIA646byrDtZd8eODcE
je2JW61rfKqAa+bLkx7eG3MVdhhME4HNUw1fAr/qmqVmoyOrYpetcxbBmArSsDWL
BZIZBlQjYdylA6X+jQBIDVIOdIGiD46WuyqotvINO8vAM/f2QXmhpM8WJMRt9lZF
dStyUYTHdr5wqqi1xzSx6wQEjn0LeErV+KlNJzGUy83KwEbYhZ06/iRo9BiBLabH
CDulQHAgLMp4qT7xUoP+ObUZxRJ9SjVfnUXFGOLdF29cZ7zj2RKKLU3GTYuc9KCC
u7jTzXDEG/O2JeJCYFc9XwYtj87VlmuuL2wg1uIQp5n9dOsAE1GGw4rvSgL/HEmO
Gkn2jCTgTI9II0gDF6Em86DVcNVGkzYGACNnw5Xotz8ytCbfIXcbHnOYVAhJHkRo
bDlx/DcE8xlaY88NYCDrSlI+IW4c4Ivtv+++DZxx7F9yzGwR6b3LL0oO4r9R900I
rcClvOw+8bChMsJtl+9JWIlASzGr7bRVw8SfLvPpidZmobAwYtdmcFDLzFITPQrt
hyk=
-----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