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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIx5TS1a6/vkwCAggA
MBQGCCqGSIb3DQMHBAhJgb/YEVliwQSCBMgBAPL1R0pjR2ulQ5gXeHgmhLCJzLPg
0yGzKP6M9enxh+RVDCTobw/ll7pHeuQMF/nMgfSYWu9MnNbmG4ovc+PtrRVx8isz
iZ2arg387bfUtj7O6ByLkdgKTlGSEMUcLm+L27jIR4HydWB18YvSXz854QGSe1Nd
mRp8OJpS2WWiS2v9GqZ1Vps5lDJ3mrBlhc9bEF3e0qLigJZqbb7GetYQzEuXh2Uw
E8GsZQvuPzRJSTQSUXWDoIT8bJ1JcJ/UjcIeKMEaQzQrkw+cq+n06zdTJPcfjWLr
rlJ3obqhR2LVvRjYi3yVStVvnKjDwp8KsnSabNhRYVnr9pbX2J8nmPkzR58oEshp
fOEUpWtnUMZr2gaLH8Deh86MEg91XXtcE7r6i6dsEjBwk855pgIrzMqU6Ee91WHT
HFtrjGBovivMY3v+eIYcM3vBL3I8yHr6iuDqG02RRuNipDd+jhn6958IPip7gc4C
fQ8A25H7iM0LXS9nuAUuYZQE9ud6VDsG1C1Gnmhb5XN2eU6VEa7cjZNPRQVsD8lN
CNHSL+1gsQFWobM6hylV342SX9TBWJQG9H2qXpVjBoNUhYBAfTv/2XochejB0e1B
e1L+IgWgy82mt6X+W7qbinID6J/EYFhzoD+JDKLS+/upeVoZp5wwDVi/f3Fyx5Pq
TqD1BBZvMYvoC/U/L1Wd9UOAmaf0x+wLrWE8cR6OCy1FUnaxJa9i1sJQDIxCY1Ww
A0tN9EZ1cZ4MA3kqfC3/ka3ozkAiXsI5Sd17xNjAO/v2mzXkE+yjcKqof/QMSDbW
WW3ZkKL4HOJfc85pFt1HDxSKq4tugAORDuNeCyjLzU+ZsAKstmfOFqFqYnZ+8ZWF
lx/9TWy/Z5xEwSoeIG83bJXhXjhFQJDnswQXhvX0G3dVDy0W35s4qyyBvbIGN8Wi
U4GdLL1eEg4zn52psvb/SwoUYMnOwywtr/uRAdaGnvvL7porNHv7PA543k0zDFw+
e6C1KiWiy6zQ96wZZKUnNd6a3Zp9xoxW+YmL2A1VjUsUe7TtP77oSw3P2l/1TAsZ
xijX1HgnibWtJwd7dya4//NpDQ2dojObq+6p9TTWYisJGh1qDG9k7i2qG1N2EweM
MJnjCsKrntMZLTDWYBuODNoJF1csVGlP9Ivna9zsFIGM7fOIe4y8tSfbKPRA+5f0
XfEGi8ULT1+ircjGRgtBGcu41p2UOmKBWyGCUL/G1h1n4HpAhcfvrhgfWLGqt/Wg
2C8gfay0UFUztLstJiX592orsXRG1CzNreB6djLuVHLtCbrN8Lp4oIJvNM/84uEq
F774b0fGAzOqDLKqpxeARXugl8pF7xfoz2VPqquyTk9JXhl95hvhJ9h/AMvol0ow
L5eQf/vwiqijRXm0EIhzxvNh9j8RR0oEwEs4oVuhmwiXgHJU5yStlTVCZwlecT6G
8LRf5dzg1BvhYJT/ouYY4HxpvppdiYMkg5vJRRPOkPWryZTGQlSjhrmbXvv2roY4
vTjlIIifTjG9fQrB0xnMzxRQXoFmJ7hEu6IFR4PRErWPdoZ2+e3eI1E2mCd6jshQ
FTyTW7MB/KU5xDIJ7oQ7OgJ2Vc+LZENfvlWEw+1Vdo/1kE95yIPq4hWU2/EPpqoN
97c=
-----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