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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQItjDtvfA0JDYCAggA
MBQGCCqGSIb3DQMHBAjwjCc/tmkd1wSCBMhSk5Hldhh0CCaKARc6swAnq+Zm27wn
vTw5InODP0nDf1kEHBU4lg8P3cFdcOmdMTtW3Hn4Qh5HtxvirY2q+GDf+tw7UIUS
5SYYPOQKIQfaFAAISkWf7yDTTIqaRQoD7qzZvwroGw63yxPEuo0Ry8sN5JEjabAs
sWsAooRwq/RorhHo5TuLIhui/NtU6OBuSAjJm5UExiSIZqkazM1HPNJYCiisE34w
fSoNTrcBYXLipc/exjy3RTszYTTTj/pEEcninq9uI+cOo6//UhK2VAitiUbMZTc7
NWb4wEQpuYYrylbdhoNezBjkuciKf9JecY71pMLM0GLst3UDg5OWQp/IvGby4Iwh
h1HcquqEPbFLZ2qshiX+DpPG1DYOotdT6btNDRoO90QKR0xfPkLzjNYIsl1VFOpx
z9U8RprhpDXNuc6b4/xX6zjrb5kHK4WKaPdbFma2KtA1nTbSl29CATapPC7t9BRx
uuR8yWiJYA23WBM6nSV8yACNhrfN4zKwsIBMa8ysd9XQCVWrhgKEgHQL9YI44+oN
4ictxTCWEd500clA/uBNbvKEO+We2Ahxf5YOhyLCWJyEuTXCGDjo63b/jLLzLn1u
BKcsrRGAa1C8SxHs53WzRdH8gkw8YXKihriLcMP3nkGWldtzInZgL7Jc7+6rpjno
8VCS643ICfi9qqKprzMtq6WL1IoRdZ9lH7O5Ylu7Asa3Ee2qg9nvWI3WWm87CFqn
gHvrmEQ7vLroxRGvMbw6JW3sbfBJtzazi04rvfNTk6E7ce3KQEl0sh3bxQ/aZPRU
hnOtIaQZxaG5yeljpxjLVKUdiMn8fatGOk7324B/ZDxsgfiqTrPuWe8Z//S1HoX5
kFwQ61jFoh4LjHhbjcppsbd4H/AZw/Xu1tPD2C9jJj+tslEBoS2DodheAYEH94+8
2XOD06QaeBHHWVUKo6zlXli21eJc6SNLXFyzGEbAzNqvOyEBRLsCH+Fbq8gav9t8
ktUGUw/pAoJkurAxCqHFRvDPcRHouSYkx6YNC+DeGI3bykqWXgsNqxsN5OhBH1mU
Wry2tka7PjJnJaBwFS4f99tFCis+auCBp+pgmLGXs7fN2hCIxmd9IZdR/dFk0zhz
AJzJf3RkVJ9VfuvHH3ugLCOhDwVDWRnxYti67xgAUt4kEaCNVSe69BiK1AQOPGwU
5tc3p0JtlprgL+RV89A/cKrnZ+BXl0kGhpkEKK2e6owsIzGxD5cSxkWVM6DF31+t
xFYOf6orvP6dpc5ZHGXnd9KG6QYoQIQMI1UFQvCSEvtM4kFwuP4rMwo2i/Sd5LHf
zZy2UBmWHlrayaZrYCgx1PBY605xl4+GlZ3vuKI20dincrzh0GMR71CSJ0fD8H5u
1nMc5lkOBQtvy1m4n6HKaSNQfvtddr/tFeOJupX7GD+sXXHAKsy8lyyPT1wbL239
Asikof927lkcx5TXy0TxhjN0Hx72/iEcpbbWrJTzZmpNJBPlTo3x+ZWpwBvW7CiO
60W3PEfNx6mPQmrr+Eh4H0LEpx/6RICt5gupVX74GYaE92PkdX1otlOL0oRP4Jlf
sZeop2W0q0y/EyMU5qOQnqY76GxhqFt+8kDdAjMZjzl9sOtZHs9DlqNCmpH+06v2
NUQ=
-----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