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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIGlF1ULjKoqoCAggA
MBQGCCqGSIb3DQMHBAivOkad5z76qwSCBMiV244O1Tt79Hm0VS9XzPG3XVdQTwUk
Fw75TevTkUliiACHwgdJPDGzTHcCMrG+5MtzFToMJ10YIHuVJm7C6LujcueDwbAS
L4NrI2EJST7yQWUdnYJZULFCR4WiIDN1d/NO0gP74aSzQDHSrtKl4MEb/c3KYwHX
k4tN0qn2ADnBSjnQK/rpaop95ESAPa8obnZoW4yse8KG3pCAgG+MY3qXS2IgK2ZX
OOmcZmlqMuwLZYE7+jcdPzwUa2BeXXMR6qPo8d9Z00y6FAhivieQftqpA7r2N0ph
pkhLl3E5dwXUDBZqqWLapo2xXflkABPHfTILfvk4cuV9F2r+mcl+t0Q/eutYTi/D
0wOcL4AXqAp83IygBRewhFhmDHJCo6pUaKRiyYX51bQBHOJEmTDOilZs6tPMJP70
bSjyN25Q/7/Mbh9mVQFSXdizikZf9WyXwCemmEWPZgLTVLB+cREfrpyNcbNsko7m
240RxPaE3Qo4YUC7L4BFeEsqffX8lAFsVB8EUEgWR27MDFcgP3omFQPRdpgNfW/F
IaxOn5W7T38K2Z+a4iO3mCSB4zmBYruPPUy4ty+DefzSK6jSd8LgIfySbbumXuWh
fYyIjYsSqGQY0XrGaDZeub9UzNMS2hWP4fV2uyszkMrOcpt6lJN/3/G6GZ5QQ1cg
AT9wzdtHETfsoIBe8sRU8L4itc8ZgQRDK4WnoSI+YgPKeP8sBd4dlhDnXQmJqnpU
M8cMaI73xqoBjzcnT+yHVKmnqSWbd13aP1LsCgAA/J06X5qtL/lKt6y79p2+tgkJ
5j4eywFTWl3fnf+6WzaohMtPBlLRYhCDnZaI7dmQhDOVdWHcJGVyRQgLclyAKjct
nOjNmCsOLam6gS8+EkgO75ySbNlBNgY4ZDqPUa1rZcaGe23RwNsq1L3nr2vOiTxh
2vk0rHGWPuwZ9LnBoVQWylNrKJ45fjIptF7wXOQUXEco9ahKRF2vKiezgKleh7nH
1dgQnwgxumUOkuOFW6aetO9/7wu2bQEKJD6zHd4nmqMFSo4SkX5XKTa5zhqaKkSb
ZoEEKHeDBqzXK6iCgZpwEZU3LVfnkKXDWcaNiRnLHHOIsLmFQlGArpSSKjAUZrXS
OdZyUtknkap7R14llNm4z9MFvp8iPYI3wiksBBflFCXG/O8w+iG6LYnRrQrMxQ+b
DBtXGQgmiKfNbo1wZOGny6Z86S59WcJMS7pfke6j59V7aoj7MEJMJnu270j0mkmu
HJIseYnJWs1Cx87lq3l+SF+0IU2sSGd632JjtO9y52i4Tbzv0/aQ3Ff7yljlCbpW
RJMqrhGMYVdfcSJ+7eirwyO04H/bG73sg5rUBUcQrC3vUcbNhUj5vCl1fPA/oq7g
ZjhgwBoYecEY2bPWJOVpZ3555oGhyc6ulQXNqrB9EvYf/qrhnlIQORN0xMETbhzo
4DFY3zn45jVyNPVYMxDvatl8rZYh9v5aGKFthdaO8UOZZWIzz0sAzTHhzdzrRxTo
nsoEHDxHDh3d/fsNd4R6EG+o1SynWoA45QrpCXbulnRtD+4v6znTeWWJ4g4ZHqdd
+cnv9rm5uvZztiRtu8GT7KTjRNNDJ4aqLP4sdsXGvNyBH+AayeMUEk6svnaB0rR4
xok=
-----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