Display the text box

openssl_pkey_new()

« openssl_pkey_get_public | openssl_private_decrypt »
<?php
$resource 
openssl_pkey_new (
    
  // [array $configargs]
);

// shows the key details, plus the rsa, dsa or dh key details in hexadecimal
if ($resource) {
    
$array openssl_pkey_get_details($resource);
    
$hex array_map("bin2hex"$this->result["array"]["rsa"]);
}
?>
Result
$resource = 'OpenSSL key ressource'
$array = [
  
'bits' => 2048,
  
'key' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsuWWx2gghR6hVEc3Wxd+
Z9hec6YWf5rFIA1wsZYRnA7L8NBNr2Uvp3iDXUKEjenyAJXy8oY/u4xe8vHa5Ibn
lvXxge2RedLx02DiLllc/LXzcpoZARnvFqpInBCVA2idyEwAIDYx7OAKxtD2/eZ6
KQfSLp6FKnSEE3MtqHnZzI6gwN7UVS4jLJCFjJ1evYMhbfwwOzYZToZhgdC+F0nP
/HHVr4OWPapABqmLmen0FHTUnif1qZmWcCY4nwMBEw210rlL9UZR69Ki/VKFUvUm
vV20XrnVHhY5RD47gaVmv0lU+St8NHTuIAPStoJsK2AVLfTc70VCVas1QqJbr+JT
tQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'h TG7[~g^s  pMe/x]B' "\0" '?^y`.Y\\rHhL' "\0" ' 61
z).*ts-y̎U.#,^!m0;6NaоIqկ=@tԞ\'p&8 ҹKFQҢRR&]^9D>;fIT+|4t Ҷl+`-EBU5B[S'
,
    
'e' => '' "\0" '',
    
'd' => 'rb R=#dwNZ͊LmqiK`Zj0v    CPDS``ü3"
e$OJ)`\'Qm;X)РfZr0 \':JPd\\S :Zd㋡ъ&KC,޲w
(WY%=rJ Yu%y
ܢm J~naA(s!#TB:Q'
,
    
'p' => '_    F {5nx{p z?%AX\\1rHZ :,Nn;r]*m7hV0L$8* 0Cj6b0´6[$]﮵I8Vr',
    
'q' => '>V    7݇U,In4YQmWlF~p,6L\'~>y.r炃Bt vvK' "\0" '0EB.پ00ّ>bpHJ9LJ<tС',
    
'dmp1' => ' .h- c1_J:ȣjq)۾YN|4|ed{c௞DhLQWljU{ًĶ;3Ou.N=ƉR*%O ΍ð{3h',
    
'dmq1' => '.ڷ}SOu콀ǯeOxK ({C' "\0" 'CHXfe` {esB@m嵧J/|eeD(3&rn<9g Y(0n؝\'Yd!&H_x9*',
    
'iqmp' => '$0>N45}}kNmV/`!p$M&0ox dj,(0NƲPh>{FvjMJ>춆Y    M](k2uI``C 9',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'b2e596c76820851ea15447375b177e67d85e73a6167f9ac5200d70b196119c0ecbf0d04daf652fa778835d42848de9f20095f2f2863fbb8c5ef2f1dae486e796f5f181ed9179d2f1d360e22e595cfcb5f3729a190119ef16aa489c109503689dc84c00203631ece00ac6d0f6fde67a2907d22e9e852a748413732da879d9cc8ea0c0ded4552e232c90858c9d5ebd83216dfc303b36194e866181d0be1749cffc71d5af83963daa4006a98b99e9f41474d49e27f5a999967026389f0301130db5d2b94bf54651ebd2a2fd528552f526bd5db45eb9d51e1639443e3b81a566bf4954f92b7c3474ee2003d2b6826c2b60152df4dcef454255ab3542a25bafe253b5',
  
'e' => '010001',
  
'd' => '72620791020be0f19fb7523d9b999ef1e8cf2364ab77f54e5adb1d15fedccd8a4c6d71d269f5e98d4ba9ba84605a989d6a307601094350b844b1536060c3bce9b1e133f0e11622810a6524d8fbbc4fbc4aa718ce29fd19f8c4f1de0f6027a8c9519afe6d9a193bda58299ccc7fb4d0a0d1665af672309e0520a68127fa98fe8794a23aa24a50fdb00484e5a464a45cd2c3fdb6ab91de538caba31afa8d130cf33a5a6494e38ba1860fc08fdae9d18a26b24b14fcd4439e2cdeb29787f07707d70a2857b0cfde5925a89b3d181a724af00b599de4758925ee9105e1790abddca26dfa8720e2dfc0b24a7ef51facf26e61412873219d2303f854f7423a1edb51a1',
  
'p' => 'e95f0993467f0b90e0991a7b351db86e78bf7bbee4e38ce97002e1b2e00216ada5207a3f25e041585c19a0e98031aa9d72485a0c90c03a1b2c4e1a6e081cb3143b9c72a4eab05d2afd6dda08379b68fa5630c5dd4c87ea24382a0d1430436a36bfde628330c2b4a4e0365bd4245defaeb5d349b77fcdcf385672ccf818049589',
  
'q' => 'c43e560937dd878355862ca349bc856e3459915187b96db38107bc939b576cbb467e702c04e2d4d7364c277e17a8c43efbd579cc2e13898ce3c772e78283b442d274e120769d76c14b96b4b98b168dee0030e645c542cd1a1801f5d32ed9be3030d1e7eeaefae5d991f33e6270484a3991814cf8e14aa83cc5c0f974d0a1adcd',
  
'dmp1' => 'e7cc1d0faabaeffb040b2eb1682dd00df263877f318c0f5fa2814a3ac8a36a71298ddbbeb3594eae7c347c8ed16503a98564f6047b1663e0af9e1844684c51576c6a55b916defc7b81e3c5e7d98bc4b6ba3b919ce0b2334fac75a02e084e3dc689c752a42a1f8b1c2513f91bfacf4f0d82ce8deef4c3b0eaad7b33b9cce968b9',
  
'dmq1' => '2e03cbdab77dbb53c14f07d275ecbd80bcc7afba654fc6784bae0bbab4b70828d57bba43a815a4009e9bb6baeb434858d86612fc1c65ba600ddceb857b65f473a2b38342406de5b5a74abc2fb17c65654428332672fd99e81f6efe3c3985170267c0205928306e8ad89d27a89f59640621a726ec48af5fc978392a8508929095',
  
'iqmp' => '240e8d30163e93fad3c44ee434e2b635f69d7d01ae7d6bc44e6da9562fd1f560ee21dc70d3c124a44df291f8d526306fefa2780b646af2e02c0728e930a34e08f9c6b2069efa50683eb2027b939d46ea766ad04d884aef9c3ec518b1ecb686a1c0dd5909a4894d5d9b28bebcc26be98bc7320175e0a849608ed1609389430d39',
]
Examples
#1 openssl_pkey_new  ()
#2 openssl_pkey_new  (["digest_alg" => "sha512""private_key_bits" => 4096"private_key_type" => OPENSSL_KEYTYPE_RSA])
See also
array_map, openssl_pkey_get_details