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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIuE/STbdLX64CAggA
MBQGCCqGSIb3DQMHBAgzZAJOlsKngQSCBMiwwY1QdQaXn43nzDAaYyRy0FwN8q3x
4lWOynxY/rej1WZcrTyRgS/p6lvIDvJ57FNOqe11ZNHTV3bgzakYPzBW1+Cj5oFz
SSMZOlvwU0a62KzLhaDmNEcFKOj0RMh/UbsIav9JY3vYmVCWXyk4P+l+X7cZ1lRB
TvxFMXNIQ5nQ8eA6Cq+yB2+fsqTG/hPD8eBKnVvq0rBNXxkWw3xERdntCwylYxJs
rL4guwBOREsCRrG5aF4SEI93lIdYo+TYAltZhuGzmBJ5BosvmxWOxeUacrbXX9+8
eOPhPQzcouMsAfBxWHNqOaadtr0ooiJyLOFxSzNwt0cRHrzPkmme96i+boKkTZL9
MJpag8m9zDZrm1JFpCjp21XCyLql8oT7vIyU9EfyGwJA5nEPz4ixu+Da8ZWRdG1C
FmsegrMgVD4Z5v48obP56QmrothzLbgVKQiCAkM4/GG66zooqIvEOWhhfF1sdU81
SeRjjcVCa4Lyv1hTtp8QILeTv4RTUOYnqA0gLsIXbFc7IbB4umxcwi6RkrxBhcT7
ve6xU+yLYc3MJpBmN9T5v7YEuc0Ot+qav2PZEbKI5zgL1BZaP4NlfaA2fyftfn1q
ecqRrJBK+qfQKLM+PB2ZCkWEn+2/CvQGa3AKhlqORp+SokWquzOzcAQxtxiMHY7q
CWF1eznSOrYAch94exX8UQ4Bmz9I7p3xvvaky/ZiE3i41yrygXjkSeYziqM5XQIm
mbxm6qs4TTrxCgKGFzSdzta7Q1arD0T8JCQiPwzTKyk2F/vcYPl/UPlXljU5jRVR
FQR4Pbf7uZAKjCS4AKdK0HyTin1CnobM6ZY8SzGkhxViHEPFgKXoYSvRwwXRTRne
TF58bFplfB0slVJxNR4oVD4xk+NDILv1Ay6uCDAEuR4YpumTbJ4thCdKgKM7UmTm
6uV3E4/ukXf9JNZsdAw4Xj3p+FBmyXuiI5bH6lNOpKoVid+e3JWyDnSemgsN8ZGA
Xw7Q9jXWEqOXSLi9WczJUC0iDnrrBNAs2pqGtDTvoo1nE8sOZcA4TXHxRkVUIAlU
Db2O1eQpgxhmZ7qqGOv7qPVcyGRWFszO14Bt7ZwMjZuQflLZep1HUYB7OJqj1Khv
+jSl2j2w+dZzzMaqdAf3/YNImp/6kG+C9+a+YB9qbONi22GoPxxuSVD3VeTyKWst
AX+WPEmIsvPLCLC2MDgz+U0pQFFegC3RKnn6ecToXHAISqY/zz5UoeGvlmrNQPUp
mRC2QMk39KgwufzmKsUFDZcYMxEU2ep0U7TdDIuXUcX2I/t1kQ49i/GMv/3U+ELS
Ua8h8eXicuC3+4GjpdUiUN6DnPDLNWTyxtw2HIjYFZkdB+TY5qrL6PyLSPRxHKWo
GgIS4isNWtpMo8Cr0rgFoSc4Eyu+vi1FCLjKCd01BPmxETwTdbMlBR02DH7t07Ck
RyCT83UdePNRE1fTJFkpurkeFWgAQkE4x6zi4qREwQ4uALoQFZkN8MQXFUjumYzf
p30ZNXZSiQs88sxIckZCfyizgTIjzUISRi4mKKPeWI8WPnAGRt7Jlqj0KVvAAekG
+OiWj3HG8bA0qzoMI0h0obLbsvgTkuHxi1wLLoMAMiAAhAnyig11tQF3iVjvT7Ey
TTg=
-----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