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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIF9CU3VNpO9YCAggA
MBQGCCqGSIb3DQMHBAj672bzwh01PwSCBMhp+LfJW6q4+HWyev0vXozQ/Pki4kFF
Rr15uXYCfYqnGuDLGdVTP5Kw1ENwy3nCQ1jk2hZwqUHDoxI5d4BXys3acjVuuOfC
CX/zdHuvZiNtEO/5jV3JJJ3G86Ta3Nh9WS4Mmi3q3lawPcYViL7v+10DKvsYpZVg
p/+EFrjODPkkOq3mfS1/Fj0J9h62XoitLJztICfU8yKZEhZl/7uipeaNxEHmAfU5
58tJgcWTpwEzkM63Zd9Rxp1fLkR4zYXGs87baqqUvA+r+n6VEZBIeU9g7atijTLP
cCGRDGRm+ZEv5FQPWDe6YH/Q6roYesnSpEFOHmbFIPFfl8sFMIAsL63QRlMwGQ56
AUBrqpRnNAghWMXl1g0ncD5DyKPpFNh9jXYBpqW/R+OB8xAaKPAkoXoYZQkGRO0m
oDwmomQlqRRaJR3EpxFDl+cYvk4xSSOJti8ErR4g4vQkWW6ZyShJRA72RvP/QnuP
7l4CRjITxWTacb7qwRryuk77CjAKz8WmvXLr2DiK70rDnuPrEpsmBcN/TH2SFvCS
ikb6OjcbsJLUvIdbyYoB/MaNVLsA4XCUxLFqrGp9cB44t1NaaAMT+gRYAEvUtX0E
XRsX98bybt2K7O3htMJpWHK38fYd3uhb8S9d9HZsDQJJcpUM8TjOvCq+XOJpgJWB
9GCmVt75jfp1WRa5hA3U7v0j5wr0s5sizYQa9G6RXpFj9x1hG+eVx+ScvK2NyjHe
6nLuuUs1SxbswJdQGRytAXEigNj7GUt76RyXJSvxfgVwS9UTc/Gewc48al1yDQOp
WpcUtlHf73XTZa6TzKbo6ixCZhraJotgCxqmrxUsoYe4E7xdweHG1C7g51chcrDo
XLIgZrnqS0kIs+u8ILgszMYhqdINOCQ/pIs1JfyPOZUjbhL2QwxFszePcODMn63b
FLWNsJqPzAhAqvoTFr6JZZOcIygnk4OytM/dLpn1M5tV9fIRtGKHJUKJGHnTV53d
u6hLpnKdS5nOOZQ8hLT4FrQXUx4pLkxtGiplBE1GZ8nSkNQqOFD9g90ZYYW2A+0S
yQ4S6pIcwjZ9hNzUTfDsZycMbGY1jj8D9qi82hND7MW4M4yvcgCEs+T/nKpNd/Nz
CRM+xEb/caslkWV4VJECiNh+Z7COka1s7jIQ6BezRERk9KZJ2DlPENOgmPfj9Jf4
DfJPns5kh+lZpnmjmwdvKfSczxPnlgWVmuVnhwc/iUhNV51Lwt+LtSxIQcLcJm/3
uc/u4lmqBAZ3yYgM0sRau03xKHRjEQg2Qjo6LrhdiGf4tK6/O2iP3AweDd7u92ne
/K9hpXcQKeIj8jk2s3mAkvB/ss/VUm1pqQLViiJcErT1B7mNr9gxOJeNuX58ikOA
CMXTeesbnVD+Ypr7u4tO0mRYNRNy1UvkyvkUxsTfflnh16MpodzIA3E5TOLSTNZ/
eb7rKa1TCIkNCpiJ4RtWtih+lphlLPo8598LkXKmhgh6pVkvt/sBYFw+3RgJRnNt
+Zr4s9pQ93nQ486LcT4N3r4TtyKx7g+oaeFjhr51wLu5h3vEAJl0J5zEIIuLNZd+
xv0ZI+FN1nikXo95pH/8JRQN6aTLASsTmHq5NhR3fdtMGJho6L2fStmxvz+9wgx1
9vE=
-----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