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-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQITLGTmvcCRIQCAggA
MBQGCCqGSIb3DQMHBAj7RUE+H4OirQSCBMhweazW0lPyPadV3x1QxWDsReQoRW7J
5mf+5WPumez6Au7OhJxYhelu+X+HTT3murLwLUNtIGzDyzShdEnAOWzI78QjvZqf
zy91T+Gy4nF2F8cUvPIarntTA96jS3exy4oLfqgPfaFUba3D60cw9dN+TVrCN2xW
+d/83GCEYPsS992BbLDPnhXYlR191s65G2axGuvgQ2+9dlMRYFwL1YPXtyCs87KJ
HK7en5uSZMdhPg1m1/PeUs4BdO7zDOyzPJKJMY3KonP4MA5zn7m/sR3lcN5ND5Db
RQYS0JKvyES3JY2V5ApH1xTt8cW39EKmFIptXrRonjzhKbM+iX6KjyoUC84axa07
/Q3LbozXDM0ETmHpk2KxhU6YbRMXhqv7YoIyolM4Lp+rTBUo9anIxzxkdnVz5ajW
4G9db573byenaSycoLseFfCM5Lr2jt1uRxi7Y4SD7vHUQtfvzS3CidP5hbIDhQNB
O0JYdqZI5LQc7UZ+EjeehOagXEkKfUFBo1F9H5Itq9vDyCo4ipxv0ih6Fv7r7JMf
CwopN1dkqeswgNvnDZzCvPVHmy56JWJewdwaC6QG1f7KDCAqDF1PRM0aWOZ7y923
nmOQJDIFIdFbojkXyXpf3xggNA3idO4PyqKzjDmPgHENQOs+WyQ33iTab1jJhcSz
yVo/rwg9NoeyBPUhUJKrPxhKBpQBgO2fcmp0NAaPSnMM1qPu8bQFIeGsJWlEON6V
d5gcPzQ5cGHxPOY//oIlHpTBFw6FKTmHPyp+KiViFswzkdUzIouGDhYXx9EczGvC
wcnIvYRCyfpqGSEJwl9Izx7BpUq2yQRCNX//g326R26wGNPpS7Wxzoe9w/L6z3WX
XLyq7psJDvmabaZ75Zh2Tmm4X2e8ViWcnBTZ5G3en60et+OaLzCy8Lb+UmWelMHC
UMAb207fHAxNm2o0ApRL97T9sYZmhKs5UE87dxMdGUVNYnlOg2rErxo9CzWWlTrw
LPVW5f6OQBQRIdRYqQ5H+L2DXfrYL8oxHvNV5Hs3kD4wGwO5zGxsZKHZltVknuAW
YFEfo6ryU1R5KpYIeUdrYPmiPwg5weH3ibjrus9TgUczgv+FEMv2hmFGQ+dIijsg
xTgxwjOQJoZj39H93TnbRdyph4ZJH8cpJ4yPo4KfeODgk+imOJeJKzuviRS9Q6Xr
FtEy8P8de+R2kyzwfu+rlh2lsgg6PyvlKWEE+0lYUR1toJzR6aLjAp9dld6xiEmg
zltsUPYchgoSKOVBvzb1Ms3okq0IXLQttnQcp0G7SCOjPDULuDdO7AgSpdrxkixH
ZZ7EcdiViarzf92DJTFA8TfouAXqZSwlYo2p37JhgJlQ6y7fgWEfE7DEuxjYp9cm
M1iSMjMMMt6OziRpYWkbwjzM9uRzxLIaMHD8zlAKaPNZMP+rjXyQEfrY+7rodj+5
4X7b2YOVX8AQGu3LGoUhMS7bArAdRrUb0Yqtl4PHSUwt3GCY2YoioG3+JxLg1aLg
nlFZaAw29VvKyETfTt0DfMzvX0og4OB253i2aJRJpbSM2FDeAYufxZjkGBtNQRfh
peDcMePxlboI7kcjNDAihX4ntQVXSYpvqq698HFpL/HZW0ifshGZrV5i6bdtSHGo
Usc=
-----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