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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIujXShgyKQLMCAggA
MBQGCCqGSIb3DQMHBAicztJP71+daQSCBMhJMTT9q7wsiDobmN7FLGhxgUmz1K5C
jC3Rz4/zrwI1qklcwqSv0UJtnnsV4E/9oheTem68swZVg9Ct3Uc5uBbPRfxdDWVu
cAWiwi64aufI6+gdN7oPJzC/9M08ZKlNO8+WldTROAa16q9eGvJ5USg7D8//KDJJ
ovWBjUNBlyshH/XQHV8u2f4VLXKdc3lSo4eMPzUcCGvhF3TER615h7GBIih9zZ1i
xweN95Zth9Y3CBirHNiMmm0eCM/OKhihVw8s2A5dyXfcwS6UWKkb8ppKNCobCF1i
8lxRWM8aBKAjCwvWbGz7FFfjYjV0lgY36BdefdqcHVve+juWjk/vdCpWpxXFxXte
kqsmOyzDUryN9jp4WnFLAErmSvRE3IdhiqnbFwJvr8S9AxEXEs9PlIuZ/yRhdDzY
LEpfu27GapA/cjztW6rV2Ja+uR26L+6b5DcVb8zenrQCHEida5aRDYnu/iMCkNyj
XUMdaxgrvWFJWAxnkZ6ZiYbGaIib7mG3ga3l53aeb7nqfbkTsmaH8Fy0eXJr6APb
LbkFDw6Ks01R5+qWXHvG8Zfx30yjEDMJgwMERK+PF8sQ0jZrHQXIamjfJU/sigCN
YDvsmc1BzubQJvJRbBBB2myMwIencvshBuq7TkeB7Q/z87W0dG76FQIuhtyY4cyw
3qdZAc6zcAMfmMp/6AiAPop/FWHBMKyIFXUm9XUhoFsXgFAjAybXrdEuhpRn1etz
UBzZVGfTPf4iRv23e9o44pZMvraxxZKo5vQR661SCIRiRaVIYdQVuQ3L/SCLxCxi
8AowHWdfGxtVN8S7dkvGKwfYLK4qhlt7NVB7aEg3lazgxUIccv9PaLSpG5r+s+9e
SahR36b0cb51IpCRWAWhSWrJ5ZnDJVZiWrkRGk01tDIq2sozQ9CCO/K8552+gSqE
WOMfOAkI1Yygn/WC4sgnR5i1UMVFYO2tQdxR1l/DZ9W8sSMH8XjS59th5NdYJ6cH
7v1bP4wwivBCbreoCUXXU7usjeZ4qUrBlvXB61tcGNPxYCxFKHnGbPTnsrqb/PtJ
J6fN6u7j2FRxZnLSnrqBJIy5dUroGnu4mLEUqK6MGuSXPyaG99tlKW8tCmVqDGp2
BI2Bt9+SiuS/5ekSQ/9rwQMSOGMRHPLRTHvnaEAuzhV4Cb0lv+Az5KWewOrDuV8g
H9g0PenAW84I/wP0eFwqFIJj7MCcJdwyRO2CuLJ1WmVDUzRpapAujjNblV0NV/Ll
+K7VVrvYVikJ8JkJnEgVrt4gs0WIdCvJ5VTAsYtFDhJPDFbArz6VJJpGw+rmk08C
ohv83KNL67PLoap3bGps1Mf501oN4Gd/nPB40maq9ZT5DSnpCZQH49dH8S6iGBr5
SYgSgWSq+I+oglwSizI7SlRm3s54h1jifS6vmdhuLozPbnnFf9HStPsJ9RxKmM/G
D7wwNBo6s+PE9A5cBPh0PqaIoXc9ecqk8rAQD/BgF0si8UBNEp+bYuEOzJgoL5XJ
x9s+GldmZWGW1e5N6XkoKN0MTUc4/3zbYxjI7IQ2PXUJRiIk2WUe5oWBsUSyR6Mf
m+gPhdjXmwGOVdqUacsGI7OWS5Pa0cZ6T/+8s2NwJFixD+pvowEmL0DIITTO+hLc
kXg=
-----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