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 PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQC0/jVnuTUH45QH
KaVRX/9lCXQ/N84HXr+5320yCEquUnfGtjGQzcFaYyC9CGXO6OQvyn68iLD33oeP
pKA3j0V4By5G1+kzSoRTa3mYglcLGxPQdRxDk4SgqPvXtpuluGQ3Ed8KdwgkMarM
eMS1WGh6OEp44LkyeK403Va5/go4wqv4HoxcrXQ0JtxAuc8Vdfkm+WJV/H4QtD/s
hXNVlVF6v+RqFn8ag7kyfemXqx4UT53gYEvO5HGi9O9BuVnfKj87B0bcBSQiixPg
nvvV/KRxtRnHFk3IVcV/pn4KNdH1ATDMxOymJv1StBSR6iBSAWVPtqEv/Mjwzkoq
6laCm38YNBI/lBJ0MjIEmAgZFtzKx3WICTps/0P+tDEKLTQFvHvDFq+3KD7//xsu
DgrLwOtelCXjwai3JNhbksVEP8cdtz5p8pnoUxUbwrqUlZLg/T/h51sykxqXpP+7
xDagYO7oFWVuP7Tqfor/96aj4p32xpCDlmpXSPobUj4qcTJICPJ/WTysU/KA/VY9
MipN6ract6NFCXdMDtl0cWEJlXvEhCeLvY03iyGxmL3syNcBNvVX7yjSZT+03wTF
IQIjo3nWM8iorbCGWAvDNIVhaTHPK3JRV9G8QB5Jq+hkywMOLKxZPblelItyC98w
nwuA5kMzLkfdLiU2mvWBUvz8kpqxtQIDAQABAoICAFXd1JBk+ZfIjE3poBi/JndU
yOXFH+W3OdaA/VkjPer+DP0lKta8BuNO7BVCiqpjKv7RXtcrMmomFMI9JBW3zwlm
vrm1bVl8HNNGxeVo0MrgCcJ4DPSyY9Wk1fY9GBLDLChEPkDEwAQL3DAti4VNcCOr
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KN6IZ2JK8Ny9/RB07XWxEv2tJPin7KT4P4XYZEQPVzGGdfaWI6LNE
CIOt+NewYXDpfavLLLwUygG1z6uzmPR5XddU3xzrW6/nCZTo0p6P2Mhc/m2iFsfZ
Td7hY/ii1vHTDrc+mlCDJrtng79pdA==
-----END 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