Display the text box

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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQI/TMlQwpAiDQCAggA
MBQGCCqGSIb3DQMHBAiuwWgjKQU+5ASCBMiV0QtxJvppSh+GwhcJIejzkbW6jzBe
JW9RwRCxeGBn1HzV5ughMnlN2QbeRg988XxCtHZdQmidv2dCRyRGwq4rj/nZ9IBo
A+haWvp4y3MWGdJS8SyNUKtVjcQ3Jp5BhCfY5qTGzFdew1LHT+RTBrQTbWojYfhF
tGoz6gWusRHF4FzWe7rz3MFbCHaUKc7LVF+xxHxyVs5bEMzC3T5/3BvCrGQ38HhK
V/yLHNtQseMcDcB6KIGg7T/ROjmpuJTB7nSveT7TekVsZmjrk42qBm+EF704yxRx
1BP6TuUy3HK/5/6+q9iCZPvKLbvkCXIgXe4PhRooyZ3NcIJbfJL9UJnLWUdD+EdV
tE943zLGE9HNuEP+NUsFXj3Nvj6++p/mrTm0GlvrIhv7ioUAXhh18uFHfCFlpNX4
nLTNcom+90pYbZ2iNu9osM9JRmilccMz//5iNgqKA3JWBJ/rLA3BlrnNLL0ABrCq
b99xj0FS7ka1UCw9uEB8/FyP+Ryg1g61H/eKDdHRSywYcQuvt1hYAIz1sMyeHJyO
lf9BzRfbVLl7VkhHeMYLCaFfqEvWchX9+a9wIRGMXg8kmTO/fNnQtHfFLLVM/E3m
DVuSjdaVuhhfCQba6asA3e1Q1Ry1a35EOcouUW09s7OHUx+RWUIZ5xf1HWH6O98F
NOKBo5pR3oVcG/IoE6H6gdAIpkZYBoBaLSA2QZTrvcB5WOZQRYaFrc3cncgE1dZR
rUqfRF5nSnfZHb5yukgPxhTxX3rtPmokOUWWgVttjqI2gtXLW8AHV+0EkG7bIt6l
EKDV/9ZKVx6eFJ2ewG3ugTQCkLtIwWjIWY7JUvg9HOU9vAcEvOq1lhOq6NcOC5jg
qbaeWW1eyM1B6QiMb3di3uEMRlnH2T8UQf4b2hDjAoQqsaB8o6cDmU3/aeYtLZyi
uVLbhIi1Umb6qh1Vo09WJMN1EXPCAcAmFkz4Ld7k7QUKJP9rnu/kaXkXykJ3DbL1
iwEfFQtGcz4cXIyaAs5DvPcGOw/CYziNIrwtvwcdB+OMHQNvlWBu5YmEf3XxCAaO
2SBxoqIe9OAMUA51Kv6/kIiVrQ42PFLLUJq/iknc1PHkBBKMmClpNF6inzTU68cU
w4Dzylh09i4ZCEZCn8VbhbD2LwW28p+liOSxeeTO8sbaS84PeXnpybJ4bxUg2jQs
aeet5yYEM1eMdcdw08t8Xoz6hPP5ICoFIkpR36PjY9SRjQesw1fiGVjYRcgVKYz1
mK6Q1+Ftz6xZplrff2huwKNG+209LY8427QEJxWRyFdbMwlFApFdktvxLjUQ59Pr
IgR8NjvUNoC9sjASXNfJX+c5MyUTwHUC61fV/9uL6XN69/QlZ8IjsFwpbMQk+ZMS
iEa4cAECOMsQGoozs5dUwHbNeS0wgovL5NrTqGkp5rTYxo3ajtaYCJQxUJSU3/BI
3VjvO+rKH/eoThu5kBKovx7NKtPT5euwC3kM5oWJhXKn2fB+b3QH1jmYPoH6WEDZ
iD9SJlFzZEXN+gqgpX1zLHSlhhsundbR9WAvXwM+VgPG9U7Xkx8R+ieGavUtEsCO
Baq51113f7BrFzO6NyjLXH7+x1GAR3KPs12Wt2gdIctBeE1SPuXYebwrb8ZOFAzd
EP0=
-----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