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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIePN/sJbnxxICAggA
MBQGCCqGSIb3DQMHBAi0mYTIhPFU1gSCBMh0l9VvghIHFPfXLeckKzodmjO2U/pw
2qwkKLYhIghQn3aru6r06bCuXLHVKny75+YoYFBGXX71uiV72vLfPMK67jCTAfLt
7agMwlezDUqjZnfZgacfL+GeJjjzoNGyamM+F3YeE9nmOd9KjuuhamDYkGHbAXmI
ej5lcAH3W3nWZldGQcGeS05KYZHTgYZEHO+R9BzWhyQsMkR8hrbXEuUSJ//yfdM2
+nAzphh+BmaNCa26xQxsI0tU9GhF6YWGTQWhL3UEBGe30nNpYpgGIC9lSrviEw+g
yeB6SRL8sXsyyfjW70LebijmB5rdXe6h0Yfp7x+fjZBBjFIqkizRA8v+v5q/bAAb
Br/ic0LSx/rp92gwJ9vfLARzhd1jmLteuVAansPVk3CHtFGwsnEX3MGvE5C3/MqV
7Xsl1QalmwMEVOs5Z69z7lzBxmBoBNMqvNUGow1mnIY/XugDzgTiOA/TMU/z1uIE
jWC6wcGZkqKTqYDJ9Idco+TfCgFHDZbEwbGmsPRjMDOoORT8VpBB7fZ/2x2nFBtR
+OGPO83RchIZKqn/Y8CPmeSNhy41kEk6L++WlRGEZ1C2kKF1B0i+NJlZ8blJtOYn
X/TfT3jC0bPLWhM5eDEuqJ/PoBM5iOXsU9XfjlHyWWAHX22jOTSJ+ZOlL8C0eHhW
1VSc4vT2g+8O3rCO6xh75tpEykPa67KtjPO2l2qY2fO3z6h7D6JlOJoQgVnwqRle
UdpBuccs7XE6SWRGxxXANZYH+BYnjG76ojn/4ObeKnqa2x6QfYkB0XVqU7csdb/R
Me+lov08RKOBsBhnmwEA/cpdAJHlFTW+jNw+q0SjvTe/6egDnrZyw6ZaYi1jd01r
YugTu7QdOFV0DEAg6beSFap9uDFZUVIkZpGkPfRjAASS8eNu0iv/aGlEAQUD/kW+
SBjVrvMLZBBhkFDPULW9V8djQndObamdU1XDpOVcE/b5LA9Iw7s1mUH8FmP/xczK
Z5d05YAXrAT6KEYD4O23pVYCIB3K8PAlNQgny5BUC7FAsud9eH0mnn0wZY7Xwdrg
2FGf3UeprPIHtq6LZ47dFH3Sk1at9c/GJuK2iZjfhzGdyVKaFEkfih9wXZmGweMv
QwAHStNcIJfnou0ESHpqf1R9ItV/3qc+4zjcWaHEI2UMRC84cKyIzKGuhr7gy37H
CJE24Up93W6kWLhDjMD9BBX2k2d4bNx/hdz7Cbf2hmb3k/I4yX8YhE9Kv7cGnism
GWyVa+M0FmMupoZ31RuOmoINjfQj8XVGL5qKZUyDLHlBLam6ZHv3osOqcjKl4TLo
nMy+4tI+Gh+E52ldE4bf4PPOxkxl1qe7Cs15RpMPfRQJEIUFMYlqjaIwBvaHx4TY
qTSQkz+AzdRh7JDFt1eYQ81hCUYW8u1j30T4bXL9AhXWNH5JFTyUl1QMG/vywt7O
BA9fK6RYw7G7QRDMXkkDo2KxDUUapTSH2bBoLJBi19D9a54SdtjwGKHxa081vQaX
e06MwrkVWiSkuUleZ1V0+Lmb9Rj267sO2kzPDldTf3ukZA4kZvSRTibgHbr/YJNK
46NXSnz6ib1o2nDzN9SuuUnXCEQvtjtiHRIgk3dPQPXHY3RFZHsA0QyiubY4GynK
Vqw=
-----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