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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIS+FODP7eoU0CAggA
MBQGCCqGSIb3DQMHBAgwDq1cCVYTTQSCBMg+fVuUFYvVwcgw+ngEciGTxmlQ9+w1
Mzl+IAJBgdr7ai5KudDwde9wFGmPvzZ9ar3HOGrUmY34YeB2nsBvMIpY+xBXNfHK
LPMpLYyQdTnN91Ywy6NSSsBuaMlVnevieraHmjdb1XL/7Jjun8whFWB3qHyet9Rq
CRLIiWZON/F9ZRwS9GgY4E/Xc9MC7R9Qkc3Zwzf9bJvmsg1tBrz4h+EKj6h9YIKF
TrJNxMQ544KMlIj1P1z1g4GZCbBFXnX3cBphxVWmhw9WFNDoWdQAaXlJk+Pq328/
PXvR1WgMGZscg8/lnnjC8rEypCABfDMlZPl4557Io1fLmBsjVBrOSIxyWWm4RHLs
ezdWMPEKU7pxW4S0wY8yHOktBzcNFVkkkYdPzPNGZvTgWu+5WrdE6Pn++/Qsj7ZT
s/mb6aoKsDZDNkdkNjKRBekjiYGu8R9zk4wL6LkkvMmOxdALZc3F+4jx4ArqCfJZ
wvIzw+GKGB+KoXb+g2tcIxWzB7s4XbiN4MfkUoy3Q6PjiMqnHTMw+ffVLiMYtq0C
CYOS90cVwz1SZiReUogcYIcZwobupN4+DuUhgpqoSBsjcvS4OkhauN+xuVasOnRy
lLrBH1d/yrhvR4A+a9LkTimMBZ0BNPiAXvomFdUrSzwHrEq6AaaUmBXivBgxRKW9
Zv8ppcOxXdFUUH1u/9NgWg1wpKpHtH14e75WzD3t1lmw1rCO9/kAiWkHmiCGxaZj
7vBzcDV83ElFHI1y/R2XO0kbF2vRS+QlVGK0uYRYSEyl6YPXS6nOGKBAf3P5xmol
eD0aDaOVKyDpc54tOMi2DC4JZ6DU0gu72pbAPngrMSZgJqvm3Dusnho9lZE+2WT6
IzV4ryAv59LLzj5WK7Bz9LgtnYacUIAEPLoI5RbeClCBKyrHwP7q4PvcQBRvn4Jp
vzRYbY4j7cquG/upnlEfnrAUXAQd+qPatxSKdkG2DHGyLU0Iq/NK6ItCboPwBFmS
BCqPomc/GADFOG8U5s5CkqEGZVIMty2OiOxekmrl+Fm4gpvph9X+103fvs+PXw/Z
rS0t/Rvp/ULLZve93ecEAvVtzpleoM6rBXHQV+onmpnWvO7DqBoitV87P7d29bP1
kaWm3Bik5NC9HM9XUd2+gEB7s+ChItC/ttWH0ObY7wDKBb1m7PNwOaJg2JSdNQ0M
LPX50Y/eHPSagoj+aeuAfBl+NHTtGUQNLRHCqBjb/bNODaee76ASDolQHftYUQGP
j2+jGj3csumKwOv+Wao7+yzglkaqasehJ0djzPYxKmpr2YABW194odZK6gUzk334
eHkKKc6yuglsJXMI6lkE+9N+L6cvGn87uOf2le18VBTHqoH6BJSvFVX8LBKtL2yT
rtP7peM9PGf9msHG6j/fkFBmIC0Np9YUHWRSMpoytw84SdMMsY2h/psxmjqsV3ix
bnRik1JG9XFjb3zr6ggQMYoyKJfaxzPjaV8hMHTGaBr+NRIV4d5dYzsdeUO1HgSx
PIICvzcCI3mjMAA98Swgg6ALgHSkO9ev/HgEI1dk3g4HufcR3kAlIFkZQbff1EIr
aRQxRl8q7wh2K0qv+OmY+jtojdbAUuzo/sgEr1tZxR0z4O/XU64X8r8bOW3mnbWh
q8M=
-----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