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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQINm8XzhvbzzkCAggA
MBQGCCqGSIb3DQMHBAjNuNB7TjG6kgSCBMihkxTN9kmZCma8J88+tHWdcaKWHOHP
sc5bnPHM48hKGCYM9taVva0ZbAzONSCL4C81v6zcd9t+xLgFmW8uxNdclgK/8it+
d63lAlngItOMHWhZnZOFfiqIlTUylqdhJJhms4nQlXoFXji3ASoZotTdVgu+xklb
6l8DbR7hYLoovrLl899XLznfMg91by/LD5tKkeBA9kA7Lvp1Yz3oBiGFmp991sRI
ZtZZ2rlfnyWQ7vbKLI6k+Wc8beLa4HlyQGuOK2+lMFuL76IAu5W3ryUJZsgKhFRE
4Lc6BzQoO8aOeEelR7QFPiGkqednqbiAXptU+h4xj1CDEhr0DWSBnI9Cbuifke2b
ZT+O7ZdMigWxCCJDskSxgR9SBO08Ad6YeIHcBOVTDvagdfXVZdx5OZJowb1DZ0BS
2v3frlB2h/aFztLV0QUnWqqxMJVzs2rFvmP9UcQ5FclmIl02XbcWtUUAzuYAz118
KwVO5fLMq69vIq+UKU54xoKjB0f5uJNn6/3yiKKiCbyoAAlmSCIqZpIp1mJMwz74
+ShasWexS0jMlV1qoihKf1W7o25KJnnMsARwLb1Uqny6E45vNKTsszSy1B6WbNLp
TGwcvmv6Tzwud0QaxaxS/X4n9a4Qms0rIqCK4MICvp8FXA/rQ5eubvejdSNbz2r1
9IT/G5SiBfNmgUiLyX8IdMOR+kEC19xQiP4YzmMQNoBUakWBmMJacNnddAMB23my
1cnvvCeXFC1wh21zI8Ch3CpnLbFN/TRp22uXdlzDkFflpkHCaXCNy7Irxft4pmRh
jzpEY//accYa6NrBcvsnoWkwy6H6/cI/mMPFy6k+RFffGI8GINaC/0l9xj7CKbL+
Adgpb/b5ZduCmQiQHo8OwrVbwS86JyRY2xA6TawiCDk7qN6TZatjYYTR6qFo+cQs
DvqmefuzmqadT946tLkeQnNCwEEYupc3tU/+95+D5yk/xUdvRo+N5cI9KIwLHuWu
0PZW+5aLy4DjRhQkrddrZsJtH74iRv6kzsZ/4aujxUahkxGK5RfvBas9qv6+8tsD
UqjbGmdkuY6X0DL3doA6pATx4oE/B/RoINO7fUDhzKJk36ooj8+0efg6HaYLAk7L
xoJpFgZyoJiZsByFouB4niSVa05jckTCgCK4iUAwLFSL+dq4prGIhffWDEmEdtz4
n7aW1LZfwJbcM2g8pyHzgZNvOIat8zdqV3EzBN/Zxzq9nkoR2QlhDD93TxcOnWql
WO7U7OLW50yz13YnD/EH/1zByX6iMBGAHTg/fhtf+Lhe7rD7uPl+h1CEQd+q67iR
wbauIvOjm7aW2tIHN/I0KxrjeVD2lwfG7qqUgjK2OX6y4efKu/KnIozzK2m+M56/
1Xgih6YsRvMWTAX1JiNElBUlvULxm+rX9ROyiyAswv4ob6Qou03gr5zxRpillmBI
gyofwPocOSmJZ+fZwuocle7kEtRL4RvNWjHiFDxzs+/tbwjqQr/dXNR377cFjvVB
sTfC4rrB8pDtZv0fjExqfKSLhymf1JXbThoNmvDPdb/k9p3n4fL3y67U0uvuzfvi
nk33XYoB75OhaDqn5/f+v6+TYn5fnecstpWjnLd2hW2BulLrGtwzLT99OHRD+REc
jts=
-----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