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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIsAEjlc7pUtICAggA
MBQGCCqGSIb3DQMHBAh/cl1oaJno1wSCBMj7cmec1mt6JomYZcI8lo8DHXm4a5Uo
6Bg4nxPOZVa4mr9+DEcSYiWnqGr5aljNrQg+pLXbHpto8JCbAUY30VGWPBdl3FXb
8aCzB/ofAZr3aoSsNbKBWRqsQXvokj7am08ChrnhExJ8R49cnFR9p01XcmoL/Qxh
1eqdL/xpdMkF8PH3As217V9b36eCDGuWRdLyRN4CqPd/jbLfnckdDQVaf+BrtkQw
3Q6SV5mLx7bTeKUCmvyiazeWkay21zcLop+oAL4IILwMGE64PDKWXwBmITYZXDKc
aS74dPhV1nFJMaE2Pua0JFFRcVyLsKDZri0X9+pn+8zricr7i06EB13zhIQyYfUv
NFrAkZX8yanBctSogFEEWroqBwoSnTFZ3CckbeF117YTvIIjZce/TqD5PjLDJNrD
cGgjcw4yoB3mqTjStOfNUN0hWMuunAPPKLEvIH3aewdc+H0hQ2Iv832rU7dkW2sT
XD18U+q4P6nodj4QVFGJbftX9gcH9T6ZkFnxt2+/nXoGi7Qm076Vp4dlhCD5d2dB
BoBvKtHQBcY7RKx77/mI4F/cjFgt41RqXopi8XusH0FnN+nW7qorMQbi/GIAq4P0
4ys7pz4vWK+YUTGd52x2q0R9LAEsvv0Yy0DbSGK1ulIsGYlmBGvUoM6DDH8Bibj6
D2716qksQcWIJiu3bAnRchvH765UEBcyxglaaWJ+LZbSfSIjXqBPANsNFs4Hc5zq
pLN6Pnskxu+fS4ymJldqyYcg5xgmhaA+2s7z7sOBtrcYPtkOGbCl/fThnsfdMF8d
cDf0d2GTiLINUlwJAqAXJGtcrg9M+Hv+AYhBdCXqgpJJLLecw5Arwzh4FtFrHsbH
8SSrFNaSxfSnsEnmkZ+UzK1RJSAsUV7Aa9PlogHqEyMoVPg8IKRcvyh/A3prGPnV
BdU3etEkpt0b5jJgZCLCeFq1+6qNb9+VUtif3Twu7fuLtSEQ5DtPK3cXXTFWPU7r
bm3C+b8nKUsy6mD3gyflue7lk6w8CxTBSJCEo862rpAM4/VgdhgngQiGDxv9j/Mt
s/7f49sAcUhG/DkI4M8BgEMXyfrGYzmWEF9KrjSNez/hyxv2vNXIkxvbyl+agg6B
E5Z2lSp37Gj6Ay6/DYf3QHwwyhX2Xv+QNWCUdpH4dMRvZXP5OnsBuIE0DjSCtCKI
ow/WI/EHJZAchVt25Af1pdAozMIOJ2UufbCYNtlXkwr9gyB0IPoBUWnKRoMwmrPK
N4SWFSxE0zNoiye4aZNissmGci4s91MlBO/NaSxNGydpPSY01EUjt3R9hELH4coT
FeGKSA+8JCV/3zq8j4U7juiNHsWLYOs3qPmaxDsoW7XSKBwp/H88HrDwyNGhJ4ce
/g5tEi2kcQMDC14vs2rnfbQyByItJjHG/msstgm6UnJ8r0/Zr45ku92o9mSEY1u9
oG+JQGqR+uZqGruv9bkX8imVGOgGK00yNxEP2LFWkLzwVElkA4YK/6XE6OLRU6T+
qNv5r4Gi0b1QwR2SccQ8kUwdNQyFmerQx2vkBfLeZ4V1vfk4H89gfyzTd2J4j0tQ
8BGbcmjGPlOj9C19tyFTn4ekk5XD0FvbEwzIGti/PaeRL7nWjGHZAiJiBY9BcJbj
aUQ=
-----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