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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIqB2mLZYaYT0CAggA
MBQGCCqGSIb3DQMHBAipnxVszOyqYwSCBMi0hG/VQC1vmafvHdDifnZiD8Pv5BNJ
1K2l1K1Ogr4bUAgRjrDpF+IQjwHj9j9N3Ek5wk4Xo8ICrZlItzmafZxZ5ujLC6+j
/QxSPEYc/Q1Bcr6NMGEQtfdKKKIxRzc1pPGVLiZwfW1royl4ppfPMuRUJVQd5x9e
dUyw6KL2fFqeAzfkQXOcDIs/2CzynSis44on8UckPMWDVbwT9ae9+S5MZz8pPspk
alMgeYY4oEl8tduPQ0MLUNtU3kH31QWcl+i9lNjfS4K8orqICYWS1fMZQ5RTtfga
fbK2EK4rp3J3byMfg6zNJj4da5G1spPt4PMx6OdoLowXNHLnY0Esvekco0piIQ6H
y+RBqL0ll5jdk1XxUC/xMshFsTBTkakOunArhcL942+UyLYxsUmCHaRzEI2/4g8o
5qeP5W4HhW9y2B+Im0XLGtFOIjb18tXV9DxEGSN8ocCQ8+kO5udMV9ideLV6muwd
KXKA9cOItxXPADm+y1tb7xS4ia4n1J6vRxoIv2KuJLCbQ/m67E7TYHbmruy5ZIlm
IQch0/1TuO2CaNrnXSx/ZEGinWsCQrfZQI8Tk5XBqDCFcz34JyCU/gH1i8GaChVB
7lNNzWIUvhqfyeKtqNoeO90u6lkMqnXF95ryi56QWKa7UnN2BcyP1FgRyHWxDskD
rwWZwCIvywIV4HA7uKELtKeSFfDqsXv2hRlT37bBw6qHP4OQoNKrjrBu50VIEAIJ
SNawgBkFzxs1ZE4EIiAoleMKkOT5nYcY8+Mc1yvLXU/yHnOTc6AjB1d9ZcsqPs9r
UAn7wCA6riX1q+yygdX0z/VORl5rZQS4d7VbEtHzzvwpu1mbXAHFTySBRaMRZ7BV
1p7zwKvKxbuomrF9NlFyjbIu2Csngieo3RdYOmC4kg2HsLbWDbIhTd0MmLWhVHfm
ankscN8X784IRQ+dZ0tUDabtfRTZftJlquegyL3ZIZc+HKNUq55dVf5CqcLpjZ/X
IpUYjAYTeQe6ruVcleWGE1tc9nSDEHQScXpBtpr7Dtf25Wq7srPr5uxYUnT23j8b
QwGMclHA3a0K0F495O8m/BXyOS8G8hLifEEBtBjv3pkbjTmXZs0vZkt29Gn1qatk
aTR1XHsq4plnln6MBKMf1ShhFSm19RHGdeD2owEVUeCarTs0ie3l0/a1djh3VhYi
28NFIVY9a2qWKq4hS2HAHyrDh6uI35WwxtcIM/ZX4peASvflFXxNzuUsZYM8iLDV
IeulZ48TUyncTZ7RKv80sJVnwfo5LpOTwJvPFnLG3b4heF/2weopVEmEiOF887Nz
FX+qNFbU9Qk4IeSaYgai/jnrL1gYRtlYlbEkMdMAwijiVb0CTy62zuDAfgkNdXHl
1PLlF/7ac48wOYtz0SVSbM3CTA+h+7ivO3YTLb1WJPe4H53isoVhr3iyi5kCYoZj
28ftJtbqACY88qzq1rWwub6nafKJCooV6Gn74oxGMhpYXOmYVeHjBn6/GPUizYBl
8PkFbBABcTeM4fA3/QePSyfogVylKgKvCILyAntzY6LjdDhJ6ecAPSuL+wx1bS41
fOM2topGLDFhikiciLDzp7BIoh+ou5+TewNzWFat0/uaWsviNI/4pTydZmRU4dY1
iqY=
-----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