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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQICqdj5fPDRAwCAggA
MBQGCCqGSIb3DQMHBAjQEpRgkrqXpQSCBMieiCpB/S/0tTd176w2w5seUTaO9kxz
FT7nvxDAqvAYl4Qp6VoeGRDTVXScYnrZpktCGVy+Mx8MJQBcClDsyRFjyMw9AKKn
9okBIixlNMP5+BBYAmL8ve3aw3C51ts80eKODRIo4lQKVncRV6nG39YKtjLVYdKR
L41OO+923xigPvpZHMRbJ3EyYUEqdj8dxTuydmeX9UHWrABYumESD973DwVssSOt
VHPRhKsn25H89mlvaumiqPTrjHJVjT6gVPih/XEAhCu5aBXks/+LD0uERS/Vv99C
lK2W96C9fajBChhEgXKIjS5ptx5sV/Zi5bUZ8W/o3DQGPrArcX1Z+Quq8Ry3wqtT
LjrT2wLP/l5Juts7TnRb8JTSHsE/hppV2plRLjo+Le0A75dIRGJXnFrT0LwzzHBy
4m/3fmzP4PkgFb3l7Pw3j/bxqtxOYz4JlpBFdoEi53CWA5twjBMejMVdqY3moQYm
nJHlH+EeVsj+CNnxk3mVWF38UxyWFWoRuAytfgOoMeVug6fG1G2X/H/gpPujzDX3
FrpN6IYtfKrd3+XsOvY4Q8lXF+xTlG7FfqZoCeiZB1aShbs23CQPUyEWpKQxurFg
tzCPmbV+aHlMk5RAPZd/O35NhXqPp4vF9WNP6CbJmnjWQ2sJk+elE2g9DwFQpVk+
qHjq6mOzaTfo7Rg2OqzgPIar9v+ieuZVgF+PCymXukBwA/OYyk5rqWlw/eoXFAEV
dO5JCS7HpelUfonJ3qcrJY50DkU4lEUtkF+xlC5PiqKOdEqhh4p9NBIQafX6iQBe
hdoSuQkp495lCXGEofgnqq3mHlPSGeDVx+ft0bP6BPVhgB1pcfwwLewili/TWJ0F
80WpvJMkJMYE3XZKDruWtyJ9s7LnfOYYUAv+rRabKSkRzyCjYvxLzm/edGnmplUo
ipE8KLxU0OSBYGvp92i1QY0uTd4dAC5YL5mFLv1jGsrb/egPz2i7Pso1RulAOwwJ
KtFrkI3XsnXD0xzj1lJobOH3edwrWCBgrx5gytPsBGN7hrTv9hkQqbrCSe5C6xbf
CLkwJT+WK4RBza4bD85QxZADz0eGJHm7Ug2xnB9857ovhUoQHoU5I35TEZXp6uhS
bdumgHL4MbandvprLJnVwMbEkevdFqjF5be3NvObPtb6kYm+0qYlyQbK44c17OlX
an3FamOr05e2WZkjdse/Q0ij4gsh8vwTiDevE6k8YUrnYFZd3xdF/IxtcJXi5SCb
RgZ2aEWFH57xx7KUFH6T3m3gKgmduwuN0tLGRaVpF9wFGBqKHzrScFRmRTVix6QP
obZg4bZ7jw/rdkpnIwHyLx2o/5NLB2dGlvgySQQlCFKe74G49SpxRomlcD/7hz5I
F2Y/N1LctcklonZpgJ0qnLgchx58rzQ9PQ2mucDY1yjT8rmiwlbjEogOGwysRsbr
8NV743ZtaAJfvuk1RFub/GjPj6PG8Kmz9ZhAKSChcaRnvp26V4GrAi+EGhSWWDvI
Zfa8ssGT/SR6x/iMlIZcQgJ8vepUWDjqvoPjP7M0OjcO9pVnpg+BzHse8MYHEtnH
1ImiSoh92zFsYi8dp5KKZdHfWdo8lBM2Iz3bOaYYMfjALtDOpKsMN5OqjJldmpv0
Snc=
-----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