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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQISxEruhWiqzcCAggA
MBQGCCqGSIb3DQMHBAiwQZFjXLVEVASCBMjJT0jBih64xXl+fi0PSIyoey0p4fxh
wRR6c7dDqJZNEeE3MZ2r1r0Id9CJe3nDJdhq2hV0OrtJZBuCrhpw7waRg2fw0iMr
AcdJ/tSMbUiCaIpIcuzY/6Nz2Czzmp5+9m6WW9Fa58snbLwaRBNGHf31b07m7HY/
YUPZxELoK10RAlANnaH4YsRWHmBkrj7MQK8j5EC4C4BYwfeJ7aWgz8fVqF4mIKnC
j6beu7yQJK0n5xnM5LYiZf3dCtgHROQS/dXJYalCO5cUj3rvZrhI52q4kU7BzDQa
/aAGIiHziC1cojMaK8X3H+S0E0QLOphqgsrk1+vg3iq+/bb+z6VU5s7ajjdgH8bb
IYK425A6lCoVutF7DqXnRLjAKZsNX2k6ZfeCuxG2sd2BniQXPhqpRqaFe7DbQHK5
t7Z+kYYQQERy87onQhGJxnDHld94LZG2zK6OyH/MGLa2VrThsA1YV1SmOrNgSWgz
sylsxf4M+pHa/Oxt555e1r3a9FqrwEZRyruoke+gqfzc6B+P36k2z0tCeCsL2pGq
QX5/oQ1NvqZmp67aCHqqrW1XzKhk1hijYAjnGkzKpq1uTACrAjmHDy3PID2ZxGMZ
j14BfWyI9e/o9DYBgqmCJv82RUFMLkxqlZkk55Mm2idmfAdcWTFbjDoxyujF7jfd
/UiRq/3wYgCUy2ZjCgxYmrh6Lld5xycbSrPzeRAL/D1UTQg3ygSmnPmQ5sGQnVbf
Br42jxZj63Dr7FecoYMI8Mpsws5JiyDuiu7Z11npLVFHILZD85nzcG25lizMARER
vKJ9oDXPTHPdxbTV85aIJFx2nSJoXjMUuxjBGH5xjJhz2qeq0aN5zuz2yvTojYNK
GHQdwDd/gmNuFlUwYJWOQ7/+2BOwiwZw33cNqjPN1dd4M1WSisT1KdqPa/7QD54B
fX7rXAfWe7aRt1ggUrV62Xhnr6k5TL3yAIYT37QgBSBuBjGk3eSQfOno2VWjBVi5
UX9cyR3PPadwbpiMwpjw3yVswHSGz+tRKwgc0dj8L/miGmkL1Z6y+gXl4T6I8xa+
XZmsWHWueaUSCcJeFTG5WkFU+YUPgrAX7OvYFG8nfOe1n6S9j5be1qZiDxNeIwr8
iuQhlD417pKr5IP8px5o+v0HH/OkP/6ZSg5HywPXn6gUgx0HerefwA1FhpwmAevK
PXesOw6alBhohnvsPWu5r4EddJGmA0H1i5RBOF4I41Dx8Sb0Tf23iblMMPAvaIUr
aA4CMFNLNixlzNZw7Dn73QMyLFfEFka+OxB666biYSLXdIOiL/71Fn555ado/TWT
7K96m08nkl3RgdYXc/S9fIXoT/Z/FriBqcDzlkEgjVlGAyFvb/dMDiIaBvlul4j1
RiAqNhmNpsj373MB4CgqlTeJ2WE1f3QrNMvLKUXvlthyjKltYKCehMqsSzSEuBSE
dWrhNmrhCi1vdwuERWnb/xdtTnBeZROomolrQCOEYwqk3/fc1G/qIxaxlD5J8GZ5
4i10coycr6F7YiXjxPxumfHLOTT3JgQl82KCRTtPIeJwOO00+lRfgJapTYmnwJrb
DL7n1TT5qaiLWtePqJAAb92lfaH7rrs0AC7Z1MKaNdSqmjFNw1TCFllQ5mUa+sXi
lQg=
-----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