Display the drop-down list

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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxZightU83AdzMnGTy92F
8BPGuGzA7NTba4KfHWgfsMhwnKoyCXZNu7EKQ/AtydXUbLj7KF/ykGdHybbs/17Q
CDLJsmMAUNoibzq93rqjKL2nAWgAaH2fyXvE2yQ5jIpU8tC8K6tYDnW6q0KvV1MY
hZEy+nnS9idJW1ecAc6K2dbcy6hnWbtScazX7wBMlcRG8xI1/Lvp8+p1meYgiOT0
7fDUgelFg5uYZOPCP3HO4PJdmRN5x7pILNTy3S1fj6CoNqemuM9N09pyL0HqNrAg
W5aNdR9uBs2fTzeSUdrOrJtBgH+yyL7+wNZOFJ946Z9Me68igXcwS6Y8fulNykDn
ywIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'Ř<s2q݅Ƹlkhp2    vM
C-l(_gGɶ^2ɲc' 
"\0" 'P"o:޺(h' "\0" 'h}{$9Tм+XuBWS2y\'I[WΊ˨gYRq' "\0" 'LF5u ԁEd?q]yǺH,-_6Mr/A6 [un͟O7QάAȾNxL{"w0K<~M@',
    
'e' => '' "\0" '',
    
'd' => '"| e(JYPzY;#XyxTmNiKoz#3$r8yJWD.¥*=6Ŗ6Ua4Mfq,    9h\'Ȯ] v5s_x6P(%UЈ +㦤z +c\\{Bd_TqIG|\'"\'G9pw}\\6",{j:$
YU#Zۈpј`C!2m J׷rGQ'
,
    
'p' => '|e
Bdc~VkΘlwkxx Mhc6Ʀ;e }rBSY!J$]!
n|(
uZ.`    $Z<d5MlVk 4>'
,
    
'q' => '؟aבbtĹ Vr    ߰;ZO ]%:ZC
m)E5[AiK-E>0x(&|@A4FA*%], /=SG~NEM'
,
    
'dmp1' => 'qHГ3kزG_np\';Vo a(5<J?y|l?Z z3zٙՇ<        N:v`gSO1o=^\'gWC',
    
'dmq1' => '6A    2[A9\'mX׊\\[۽Eަ`#bh3~ z$bn L+?BxnZwI] Wڑ6ɴZ^kt\\*3V%}3U',
    
'iqmp' => 'y͊)<dUr{-Z2r1]I Z,jxv.dZ,"8eψXhSlXM{%uCRG^"y    rJd$i_X',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c598a086d53cdc0773327193cbdd85f013c6b86cc0ecd4db6b829f1d681fb0c8709caa3209764dbbb10a43f02dc9d5d46cb8fb285ff2906747c9b6ecff5ed00832c9b2630050da226f3abddebaa328bda7016800687d9fc97bc4db24398c8a54f2d0bc2bab580e75baab42af575318859132fa79d2f627495b579c01ce8ad9d6dccba86759bb5271acd7ef004c95c446f31235fcbbe9f3ea7599e62088e4f4edf0d481e945839b9864e3c23f71cee0f25d991379c7ba482cd4f2dd2d5f8fa0a836a7a6b8cf4dd3da722f41ea36b0205b968d751f6e06cd9f4f379251daceac9b41807fb2c8befec0d64e149f78e99f4c7baf228177304ba63c7ee94dca40e7cb',
  
'e' => '010001',
  
'd' => '22ab7c070c65284a1a59507a593bde2358a4f6790684c778546dcfd34e10b96901f14b1f8a6f7a86233324e680723895941a04df79ae4ace04578d441a2e9d9bc2a5872a3dc4f1f136c8fcc596c3c80336c9556134f44dd4016671f8f22c099d8c1939db03ae68a31984b127a8cfc8aeaee25df6802076963573b2c8d25fa486f2ad78e8365028152555ebd0880bde2be3a6a41d7af71ee1fcece3149da820cb2b635c7b42acce645f80c5547149477c279822d2e527a1d6daf74716cc3970afd2d177887d5c369d8217b8228cdee72cb9a3ffcadfcc7b6a3ab898bb24898a0a5955a0235aeac4db881c9f70d19860eb43c61cb49321326d0d4ad7b77247b851',
  
'p' => 'e983d87c65960aec87426486e695637efa566bce9804e1c46cfaa6e0778ca26bd0e778780d4d6863ce36c6a63b65da19a3050dc8fccf1aacde7d8672b0f0428a94531bcff859ef21919b894a245d97210abf6e7c280ae10775111bd9e75a2e0ecb60e3151f0e098fe8245ac83cb6649a354d6c05b956e9ec6bbb0bfd343ef4e3',
  
'q' => 'd89f618bbb13ed86f0d791ad629bcfe6740ec4b92007abb15619728e09b6eddfb0f4cf3bc35a4f0d5d253a5a430a1a6d9ee629a4f306458e1a9c355b08bcb09241f8694b2d45b00292da3ea430a81198be80da78a07f289ec026b2957cde4086e8ddd641344641d5d4e42a2593c15da82ca8e60b2f3d1b53477eb74e454d1df9',
  
'dmp1' => '71481dd093338bcf1cfaef6ba616d8b2b3dd12e5a147d502865fbe6eec7014273babdefc566fb3f19f0b61a928ed8b359ea907fbf5f0be9f183c4ae9febe3f799ce5087c069e126cf5873fbdf1105a0d947a33ae157ad999d587dc3c0488f209094ed23adfdade76aa866067fd53fa4ff905bb1eb7bfdb316f3dc95e27675743',
  
'dmq1' => 'bbcb183699bd41eafcf9f509b9f5d7fb325be7419239f4276dbbebeaa513580ed78ab3e95c86fb075bdbbd45a8dea660a82362b0e41a68cc33d77e0de87a241cf762126e20d64c2b3f0242d1f6788da0bc6e5a77beb3de141a02b24914125d2057da9136bfc9b4a35ac75e9e6b04745c2a3356131625c47da2fa809133551289',
  
'iqmp' => 'a8851179e1efcd8aaf297fb0f03c64b9559fb0727b2d08985a3272b284808a315d914904200f5ae215f6d6dff1cd2c016a7896c20f762eefbf64f55a08f48f882c229a3865cf88b41ff5f658fb9de568f8536cb1c202584d7b1825ce75bb43b1e506e09011d801cf52475ee6f42279af09724a9380c064c724f0d87f695f9858',
]
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