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/QOlfYpGoj0CAggA
MBQGCCqGSIb3DQMHBAjYr5AteAf3HASCBMg15d/6VoSb5afIV6p3+vn6if2rFLZ+
aPUjxP97hFE0DeySh1dlzJzV9RXzfRz+LKl4KAwtEYcp4KdcXs3ZVewu/GN3jonn
eHKv721ZWL2NZuoR7nMEjMMNpsDmB1Ec5jooBUfkJTn9MbwheCdO22AeKXBc9IMx
+Ufo/BUGc2j/jvADnzY1tw6TN3jZVodHxkhgN8nkxqy4DyUIYrstE3XIY9pMcozZ
pHgZIpgjcYxWvKHRQ3BsQKg/zPz3EUjSJjbChll4lhbm/6E+MZiYCZWwqMswrb5H
t1gd0KWItx+lXGKWk2IAjmM9v3DsOgoksuPaFqOGiI5zWkUnH3mKPoeo0eiyZMiO
hudBDCsE3Vg8lVRWUM7rzNnS5NpqkGcJ5gK/v8yZ18UsU481wjunjTgfMFsFdNkB
wFoUaSxfN0nHohTmj/Rncp5A3DFBsLEG7kQ1WmTQMQV34md2l2ITFfaP69yFUy3e
9Mg8h/AZpRnksNmLJU70G41zXaINJpwu5+j2RxP91ErNc5Szk19dnCOpmA/b5OsB
r+O6lx8xCnA0oZ5RZ2XmqF4jb/BRUJ1xSV1sV7uKKhXH21waXSAEwpjPLi6EfaOI
UFllAhrle8Qgz5JjmjU+EX3kK3DNcdFgkoPsst3Q40ebhmHDG0HuDspfsGVD7bSe
5U2MNQJkmDxYC8A8FKpQYcz3JU2S8X7nhUx58EqMLqFAdpsJTh0hUkjczXtRo9CK
VaPDjNswkP/7lSLWxBneRkHLadNFMG5xFBgltvqZP1YAo8aV9kyRQLb4jytCnBRe
UpBTi1rCSEICOm5CQvg5AJ9IaUJBaP23KmHle6btKDQ2NRCqivDd9AvSRXLsnUuF
FKLNmSEJNDI6sLv1PTopGa1geC//oMz1l+hFAFWzFU+Hvcul4rWgNnehBwLNB0sJ
aQpxJtuh+b9QuBWUWyXnpxRJUnyrZvFlvpLwGFOZG79ZdXczN+VQXCxYXsOSXVRV
XE5QFkjllVMUO0QQ0qKkfQN9Jk3C/MwvKJ9E/TSO6uxPpA4zExRONoZuJ+xxqsj0
fiaRVYJAjNSR3UGo4nnSnIgWdPkdu4ph4PkkKlIa10OR2rEB72UgVduh/wBGsqIL
39DYinX5veXoZRF6R9sFTJsqePOguMqNhL+Ry16UOde6jBvTo8a33mrfCdd1rOCS
ZXqM348+mzdsr2yiQCttMXoGKEq8oIqiLC5KG6RtLvKV3sm+9aS9sm7SQN9iUT3K
4u9JxU0xzJAgEKJ/Rzh7J7sqz0eOh2xgnaHaArcYhpmlxTXrb46F+xqhn3ECjUaS
JHVDl1PK87gpeTstjeAIb4yhFg4jLH+Gyz+3OO1UW9Qhy10KWtYiT9qJnAN4fl+6
W2HgFIIit3MPiMwwGKayk3Dodfcy377jzl94z7wKYTLWjCtUpQN6CGtD+iLjg30B
8qtwkb+xIGQkAplG8kSLcmQqjyCFHN5Py+0jS1i+d2Zs22x4gV/N9r2QcuzP624Z
Sp1jJi6DX+ohAXaST9r4UpquV9ef4G+5D8cIWtEE+QK+xEI1Gy6TaMJGd4khKeOq
Ioln4OPi7QveDGZXegA5Kr7aK3TgUISPf4UgkhdkkYospRb/ANS1Rshp+TeGqK7u
+jA=
-----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