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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIdHLet+dALdQCAggA
MBQGCCqGSIb3DQMHBAgsFnUpFR/BMASCBMjOlYs5uqZNkXaV1k2oj5sRG+6CmU4j
/5tKCYUOb6e+65edyvQEiYe3XzC0OaF58g5ojyp7WNJZ0faoiXcVitbkxiuz1pI5
DB37lohgo2+kJRv6Py7eGGZ/TntyOsgxd5sHcn8De9qKijSrKXjml/Rnn8WqPpvr
sBxr8Y7psFsOWRtR8nRJiEIEN62jC3aYeeGpY/ROJotwhFIzbxxfmD5PgDiRPSwS
QD20mvFPQHxLDiN/QEDmrXTk2m8eGQgiuVyR6pk7ix7rRry8kODnrIGBPt9l0J59
bMGPqogktQr6tFeE7wIuTZ2+Jn4jqlvAU3BcfpbBX96hFguo8tKtjYNX07mQHNs4
L48R+C2gq0k2uJ9cDiivE4MP0XIqi3jRDW4rX84v8Zf7Y8NFkoERnxEnTq0mul9N
UAl9pCbcOz9nXsJbIlDmrhsYJSxU+ZIP6HDGS+7JGStqNsKa3ODxr0hiXyfsL6xY
PtHJLCvCYC8739ssbo7D5OH5TH7CuJxYSlzgI373P5c2dGKXd2rdIsU2eoIIjQUj
jAj/qkMXZirjW5MS8xPm1OxPz5xNMTTk0v/L1dEqLIa3CnUnFExAhgxLakYh8yMg
FIdOe7EN+h4qHDGlREAscCECkegSgpLHWBW/DVuuXMdbDBBDC6vmWhYSdNfunGBC
zavVPD/DCCHUK6pS8Uvb+gKxzmtz9c/1Q6Lq5zHaGHuiMJ+/OCCg+c6jsfJ2s+yF
d5JKmIZ8/a9nMO9czwV+rhVDgWyPhTwgCM0KWPk229cYm7hSLt8llJiPH1Bg1zJk
W9pIlnv2CwmsDtBMx6mhKA8eeW48rTKp4PJPux3CTyCvrgSUfCjUAeB6XOSt5/OQ
o/lnqrJaW3LkF+tGh3OGUJSzL9eu1FjgRC+pk7f6vQs2hKJteKTApjn/3XM5U5tB
X6NTxUWWQlxRrIlzbJSLDQMKt9KRglZmtS3k+5uOIrtTdFNlRCSPRKoyxJ9+0RTO
tlM5ZnSUvHA1Hr+5M+tDabZffctx+njhzpi0pTXYpm0qT2Qz32eOP/birbJWb2bm
/4dk1AViqGuNAn/+N5PaOU9XwTsYtpKl0yyNyaJnxgFL0qo0lH/Nsgsib2oG1Qjy
6BA37OoU34MABt7Jy7OMfLQ2n/VgOdpCrqXZpCXJJhAwQuPtzghj+tKqaIZ5K46O
q0CmeZBzfvpnAf2HzwmqGRxna3SUHkN4DE6BkvCl+66UGpJneOF27C7ZdMxBoReg
afihHjIT4OftNUGeYKuoQXiec2FHHElcO6Q21SQ9i9P5CYglPRPrmBkDoeENiiNV
KDafNVtS19cyzB4JJRpvcL+SrbwdRzy+vsQADSEzhpXjhhrsbp1a9sEOU1tR5UoA
64i0qVArzAr6yFN0+QGr0y1ISUA/sTTSLsIHYjkN8D2vUB4ZZcFKG9bL2B6ylQXm
9a9y+VEm/76sot0F6wAyM/5hzbE2EmKq6QrP1duXQJUCWTsctsi+uvaDEbG2Negk
RRUzeCMzxeaq4Nf6hONyTORPEPnwG9+JyCfXSQIzTsp5Q/GpPvJk3wlffEX0VZ2Q
i95jwkmUUZfhunZJL0TOHsPEUXi5Y0aJUf1q7HP9HEAW4lCUidYPZ3WIy9e8pF16
RBU=
-----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