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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIWQeo2w4N6UECAggA
MBQGCCqGSIb3DQMHBAiMFhOaqXGjbASCBMjECbGK4P4Kje7a5WhY/iMgeraA3DVo
d4oeAcR5fODmtwI1GkPNI+4Fx8Kt/Vwl4c+1NQnlqYNZCEQyN6goB1hlN842aiKS
iVIlOJrrcFPIxaiaTV0x0FGCB4ZeCha+9BL6cx1T050nw/QLgMk0y/dBCau0XqpM
Ng+AFOWKinuTbOAG7D41bL8Bow5ERoyZtCTbduXuTeu0OnH1WTGE2vUgYyMImomH
KsxWCFD9q2SG9GfG0nIVlcMN9URm67L5gAmSQBHUqG7X9tum+tOSplA75I6hGWD5
1iV4iOG4CnubHo6Hb+bLf10ADm26HiYKC9qQepNf3sVAskifR32B+HTN95bvRmgr
w/XFX4CEa3ojF76ux3far9H+R+tPWK35IfqneoWOvFVkPuNKVJM4hme5STn8nrxT
NHOj/aWg0gS1DuQKHzgd7ThmvDa3rvSEX8wdnLd46FrkZw405KnwiCItzM04liCF
VxuK0NJ4sGpL+mIPfpSNxA59JAcwMkvpiTCwWYpWbkZyLchrM052kuyAOlm6iqaT
RC0115ivq0I06dVQhThzwRCgryoBIcy5Ni4lfsUfTj0205E2siUEGszkodvRmrte
nG2l2yseDJaasycLemb8JItJMJ+GibysNxZMhqHzuYaXltwN3a4RM92XXkYJIGhq
mcK5jwO8CnTBJEoI4yTU+EENLGS5c+jYDudaf1oK82oKR1010lRCeYT2enYObtau
zUoNjeG1D81mTeG59fbX50ABgwRGsAJenVbQbNI8DcQXGf3O3slVZJRVLz2eVVPY
U4cCShYdL+IcNXyOaJISyzgUR+LzWDlnAyS9m/VXB9VobRubMyJ/jIhvti5SXfPr
jPRRWKbZimY3WNiAk/zjMTVVGUq8IqdnUkJTk1Rmd5kTEfB6BUpRcSZfo4fol+Dv
Sp44toRmVoePzZzva8Dluloo75KRSB6kLLkVOEFZyi5uK8cjDiV5tLR2RquifbUx
XmDKLaFWCEVN80RneFS2K9gOi2GoWW18tomTTCfq+So8321wyFX3zw+DItI6zKwk
J+4+xZ9pgn6DJmUhta1Jp4E4JEMBp8FcFPPGEmsjt+UCv4lYc/Kn3aK+R2SWTUNT
cEixwaofFsb2TjkN6r4YKL31QshpayNnL7K8kQwoso+W9lh5f1UKlPLWnm9mO7zp
civ0Gyc3ye2p44mNVitbaA7/0e4X3YibWzmmewsXwi0Gmvh0X/I7SGy/ufFvZL+8
QOXlAjjulFJLM56QqOR4DVEcqlD49qEcmE5kn2Cg53t+L7xmkjTCeWqi67xzB8Yt
gxZIhyeVenHA7SEEj2kcrrDo4gyhb09SgU2iT4j9yH9vPuPenyNx6/CkiwrxhEmb
+Xl8ytw/pGYezItki/QHzdrqkbkST4ARkZjVSIy+evYeKdTyAOnK56+YXfv6ArK2
4386MGWLTfHzEcxQYqvCX4v9oroUQuoXHkx2X0ECIl5UKzJ+PjKdjhlO/99IS1EO
aIs4weIvL4oxouo9uATBvC4c0nvqtyuP7WAYWcD/NtHVvmYSyz7EWfge/BdZjG16
RP5tTZOrDBmdP891d8l1iI7e7DDZ8xDW0iB3GjbhYKYhmTkhEtJmtMIrDRUhKjlg
Rwg=
-----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