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 PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCYoXvb4vwDkA1f
zdLjj92N8iMMXRHslCGYGj88Nro8f8fgYP4iqBJbGIU2zpCvIL3nyDjgGtChvTQQ
zPIHcjFOuWkfRJTclj6nCQejekUM6F6m7nrYfTeKamQY9VNPzvDF18cObw+FXM3g
M7Bv9t4tautIJYItLxlvQMqomUs6oQlbk4Y4xYDDuE4X8yGaJ1yC6gH+PliBvr4G
ffvPCHRgLorteqbUC0nc1qfVDReYGfX8FhNAPfs/IgG4W5c2V7obLfhJ+XFv9hp7
sfMVksMaSUaAH4uY8z1OVXQMyIwxIbILM5NBkFnoIaVSq1rRjdjrbybriANpAetp
AVRWiftPNEvwCGQ2se3IHGNetoTP/9J+3n9hyfCrEmqcutjy+97Mz91REgBWaB7G
axVQofrsPMF68ndrCA9p8Rb0ccTi7c3a8BgbGOLhiOKK8zGrdhBYOdPeX0VJ/5US
zzjaB62e4WNSFHTQBPd0pZnj+zG9HBPxHntQJlFVYHaJy/kLiIAjhiseMwfqWP5V
BF3APWNEP2/T2gylNi6PevxDRGyXuG8V6U1KXtMGjYwUNPKYyY7TOOb8dDQQaSQ1
TLE2EofE1uDgIag+5HFQvWNsFE3wKXa+2JbX25UQttHkzak0h3PBobLBVxXXlTC7
wqU65UrIHcsqMr1EM7sBXxTHl3DgLQIDAQABAoICAAdLUFwF0P1qmPkHIRj2+yOZ
estQd1bTDXfzaSo7g1L42FiEyiBl39qypUslPAzih7DYBL/RCD9yh1Z2NOreLjUQ
71ErOeIA3CWnbNIHOd2QDVX097H46fqXcwkuUDj0LtWFpmGuNROuh7g7QCdZqOyK
u4vLH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xv3nRb2R
skoq7QOldiAM5iVr8QhLuZ0iH1CbTXGtE4wzYYMtQ7IbxzyGA48yJaouthA5/IYr
81jQgbP8E4Qh3y7ilcvlFX/FhPBtZi4+XJqvhO4JZvxwh8co0ZrqlRBIHjLTs602
4lhGVOXpuIEf0IbI9KprRrIFLyveaDQ=
-----END 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