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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIodAdwc1017QCAggA
MBQGCCqGSIb3DQMHBAjHMOiLjEesEASCBMhPkK/hBwMYu2h8jnGHFFGCsHm1BXwF
hUcYG5shUMSfdUV2mYWTOF6FZKVOad7PxVlc28ePOx36xQvEX1LkUHUSeYYq8XK5
dsLfrdZ2qXRGWkxDZmO2eAdJUdS7AKZ6nnvek32aWnph8Bp1jNwvzjHC/v+saCAB
32EOzwz1lY9pZXtpxeaffo+A3eRRAfwt56C7Ag//cQdD86iTx6sGldBEOR16z7Xe
B5EEIWNvP5qQppQIh/w1oYJoCRPMJpVquuSlSI1aK7BDMVOMfFap1j7bWse8H0Zv
iOe/FLfIOfYyxMrjj1QVi0ZYnpAeHhrHKrUCuX2JBZweVDd3GX44219v0cB1EMux
aoHO5rSPTMzmxHGYzyagEt9TdcTEwTBQGjbU2CCZ//sKr7FFZNyRAwBXLKVmv48d
u0BlWF0ao/dguFPybcpuk9EoPth2rLksJrcX5BF2Uxssj0ZkB3WMcJpAexa0Tzff
SweCheDzE8MWL34wiZyVpafyXx1NVWr4hrsl3FKu0qRQ8i0u9FGU3ryU1zmKDMFk
OWq67ov4sTJiM52skpAclNfcpbiX6k8lUBy5aZFUB2mB/Fxbfh2Q/oeHoGg8b9kR
R3MOUcGTNFDMrJ7YNZFNYHkM05EDs3TkVClRGPp9nwITuntcL2/E8qEOH0tqdCOm
z33GLS0c4BTGWJ1M3HCdGL5na/ZG53puTQAkjZ4D1RCweOJYPFDyJLNoMPBpbjVz
VncKeM4JMR0i+gXquTS1CmmTh4vMlsQupLD7HDb3XzEBRlrUc47Oeu7mHw6WZwy0
JuklPh65NAp66kv0ki7hiWa2phUGUhdYqu4e1kDPxAC4nBsf3vedDd8IXBKCHo4n
tOAj6A7St4tsWTHrS9+eIXyrStJrD0+EKED9hyCCnFDcazIRmnrxGDfcQPF+Bo9q
ic+aKz3BEhntIM33Sot1XLTg2xD5Yb00Opq1UdH3/WR1BTCmT+o0s2+UUJa43G3v
bfSQuDl3SPuDAA3ccqpXPhb25iluc6IDnXrwANLXpEmE/xUmHzPcCMLuOVdoCBnX
PMLzbFTrktGRhkB6X3bNCgCo+OVp2+Tgpb0QwtWMvdgsnvp7FsTFFDX2w8jeRW4a
Hlotv+Q+3FRjOYzKi2Irpj8xDC+VEVjCHC9DcVnONwN28JerJiA/Lu3qU+b8usAc
zO+euPPbJ65tBZzrXtqW+Lrrp94B69n55H3FAPQ/368/E6qw53AFJwwCqphgDGkZ
KiquZlUwO9rVy9NmIjJ6tGg8KK2bCEogPNINZ/RG3qvlfUQdGRo4OsRTbLZy9xbB
bVgu/PDhWSg9pdVcqwh8G/FmmnUCeq3665YWZdkr8onX273zMNRp7X/HS9oG+Gdd
IHI8u3k79ocQE8OQ2+dzKEirNgP6PWMhWmFA7s/plmNe+Gk49dGVQI6b6KBNe+sV
zky/94ybdF2a8plDnA7QLPKflrp3XMbakn6Cvkg0pTKeOsos7uuvhDnpSif512z2
3hNc/fmmxeY6VOW+yMd8dDi/t9jdYNYtyHTZmHr3LQddoUBuR9W6tPoFU806RUjD
m8vC703j2f16iQm28cwKl50TclD+q9G8gNxewV7jih2RGWBZz3q0eGwm5Snvr0b8
pxA=
-----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