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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI3FzJ0WAYx2cCAggA
MBQGCCqGSIb3DQMHBAg6y5Q8nlOUAwSCBMhmrdImWXzjJsNo46zWX0jYeU09eJhO
6enKc4H41BwXtCTINBfUcinijmI+P7hbC1cHk9GX/Vlht8VjE1bPobPiSh4IPaZO
8Y2to/irHWyFXxB+7hUDiJApMiNxvDp9CAG8XDCy0Y+gO8dYU+c8uqKtex4C2Y/L
v8/GBpuIiu3IL4UEJGO389jY+bY844ICDBiUJRsA3CBlgbZF9lHyv/Z4mqwuB74e
IlazgrFE/eu6HeXdAelnI9HGTfF/9liQ9BavAcyBJOkveOG+i2ds/Q+maiikHV1V
EY58YzJgMNtHhsPA0VIXq+DyX+aw0MYz9QRkpETiL1dYAAqGa7iJiXFFgjJYNfmS
QaX6tRL8ndH+EjFXpVRvYWsl2KXQFSarcojEXNdZyjhMjm/erfHP7Ru5Cwdwy58N
fcmp/lEbvBlNnYI5QUGDOePhA9qbmhZKXYzmQ8/TSyF3to/UsFHG+2BaTVSTnrif
BfFaj6+tDBETlUXZ/v3kCosYLdlQs0d1q3UMvA2K28jem9Q9poqE5YV1ZvCW8Zb0
AD3joWne4EJLYAk7JxQX0JJSnyvIEISjmTtLkh0zbGOajvj1phsLBOyGZr90nfD4
5ZjCHcuoaUDHdsFi2HszjFZuv9xaHa7L7r5Z6mqDYAGHa5pWTZShFZ/kGzoYA2So
wQiWoCJv1vB2iNpNgI2YlOiCyAqQvI3foZmdG9+q92TXrYIzkx5HEQwqEQNX3xPs
spqIda1IUZrtawDhuNWuMSdVtD/Uq7WPIznq92vQLVXbwpV3vup2BMI42+t9Xoms
WRTL2fZ3Xjxat+Fn87tP3vzWuPaYUL6rtFvcSG+p3Vhnj/5V+vuC4oL4kFHwTzea
GE7DxnughEr5g3TWsZvqAfctlLRGddj0GGY9G19isdYKZBKEG8fa3o5CS57Ja465
MpjSzsc9pf2yLkOdBnNsHxaF1BUwWO4cEDiKe4SCvO6Hi5jzYwNAjZX7M5eSUUC8
UTdqvrcOKzgHQXaTIHbrvWmRoAHw7sUdLz1Dadfx3Sy5gxERrVqM8+E2jvepjIEi
D2bmKxAQZ17tLEM5CK2jIcOoKbKTDH5KNr1mRlembOtuKGb09rC2OuriaD50TqC+
c2WwCRhQaSxyBso9f0yyyfKkjcCTsAl74XrQhz5NTwHMpdUZpf/UYVOxJ/Vysqis
3hbi2mkUrOiK0kzWAvh0Pl1evLK5emCHsjb8olcdyawlU9g5uoizeWWRdhHkrCOn
gRHUceVsFW9yNFMuRVxoAZ61gSGsaDC8pY9qKUX9MNgNXKOz2LqegUy8sinf59+Z
mGZ+Izt8pG6FiLoQ9UvQThRY2qET/pUqqL2u65q/JROqSiP5vZHCF8Z8Mr7B98L3
EVxgGX+mcJwlfyYJPaBMoVQE40znWf4cBGXSx0XFNNp/6Lo3Hff6qE+CPyNfv/1y
KirocucyPtHJuEtl5ftNhM9Zw9tE0SOQQg8RunzegeaH+qke773pKAE+5EeeqnBT
k/bMycmN5bKqJWLhIedMsguwm9mPEmSq/VwYYywOREQ5RciSZoImRsLlrM5o+U4l
1scqgqZgAJWoVjWJiJMBabmYoIswmJG4lOkY/GU2lNm4rtmVWsVxshcOZRxC8+MJ
90A=
-----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