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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0pA+hPuXeeP7ZO0/8qq/
Z8ZKBNNTxFIXevQre2iZFJ9vfU80osTWwzjXNf/bjoeuBWSakPPsR4fBe4y1I9g+
nVOpdpEagZMGlFNb2k1hGg7QkZ+Hwa/vE2IKnPhMhhfv88Sn/BtIUjF69XktaWzC
mu0JzS9s4VRdYYpEVpIPoh557YqMloTZvDY9WsMhRoOpzyYcsG3DIwYmUIbsARoS
VKJijZJ54A7Tn0tN3rqMno85D2CMU7uQm0BtOQiLRVvGt3SLKoWSLWLXf0qCqNYA
paNtNXSCpNIyBukU2PEVswDyLLpdVTB8kJyFmTiq8iDTbKrNmPeCxcNGTO6bTO52
TwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'Ґ>yd?gJSRz+{ho}O485ێdG{#>SvS[MaБb
LħHR1zy-ilš    /lT]aDVy튌ټ6=Z!F&m#&PTbyӟKM޺9`S@m9E[Ʒt*-bJ' 
"\0" 'm5t2' "\0" ',]U0|8 l͘FLLvO',
    
'e' => '' "\0" '',
    
'd' => ' @chŒT#m    UUo]&zČ,.[|Dp40
1x洽 Q2JMD;NUKYka -oo< 湄.BSejQ *2ȼlp[fQJQ~Cb$S/z6})带%@ Pb}h^Vr4}w+7$tmgbqCb|"iB{BUNT"{ҙ
wn2,K    A'
,
    
'p' => 'ɟޑbX WlT    =e0ڄDoMIi&h\\5՜޻Ws ve.dbqO0`z%ԜnOɓ}޹    Åk#f
H,'
,
    
'q' => 'M(R:VVA;4ӐTgumUث#3ޕnjW3i~' "\0" '4/    -.LSk҃5z my\\?c}>qߊĩ.!^yUja',
    
'dmp1' => '{+~&oЫr[8rCt
[Å&ѫS@ V;Ϩ\'1z' 
"\0" 't;im1cW=ˢfɝ7tGXg7  >Euldq`5n?կ\\mpsC',
    
'dmq1' => 'TzB,[ՉčB׷6CT4Mb"IkK5lyk!"אB`ۄY+mM=6Py_O zlT[pMd3%4R0>d8%C|S9apz2p\'vK ',
    
'iqmp' => 'ߔ,`[[Iv +K790…+-zvuAQ԰ӵfǹ^~AT4' "\0" '>C' "\0" '@ZMbR?zl ܮV VYEV4l!hXR',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'd2903e84fb9779e3fb64ed3ff2aabf67c64a04d353c452177af42b7b6899149f6f7d4f34a2c4d6c338d735ffdb8e87ae05649a90f3ec4787c17b8cb523d83e9d53a976911a81930694535bda4d611a0ed0919f87c1afef13620a9cf84c8617eff3c4a7fc1b4852317af5792d696cc29aed09cd2f6ce1545d618a4456920fa21e79ed8a8c9684d9bc363d5ac3214683a9cf261cb06dc32306265086ec011a1254a2628d9279e00ed39f4b4ddeba8c9e8f390f608c53bb909b406d39088b455bc6b7748b2a85922d62d77f4a82a8d600a5a36d357482a4d23206e914d8f115b300f22cba5d55307c909c859938aaf220d36caacd98f782c5c3464cee9b4cee764f',
  
'e' => '010001',
  
'd' => '0d40d0fe93cb63fbaa8e1eb4c0b46899c28c54236d0955556f02c15de226887ac48cb198918a2c2e5b7c8844937034300adcdb31b678afc3e6b4bd1585ad0dbbdf51324a4dcdcc1044f3be3b4e55874b596b610c2d6fc26f88e33c2010c8fbe6b9842e429b01015365f6df6ab1510c2aae32c8bc6c70fe5b66514a9ddc51a9957e430162c7248cdad8f8bedfdfdc532f057a367d29e5b8a6254098c098b71b8f0b5062e87dab68e4115e56a472ce347dbd77892bfeedbc3724e0cfe2741f6d9a671892b081d662be71d943a46285e97c908c22e469e5fd4295bb7bc2d1420f554e15935422187bd2990a1d77d5d2f66e80f2c0e7322c8adae0b14b098abdf641',
  
'p' => 'e8c99fec071ede916258e490cd0bbb576c5409d93d65f2301108da84446f4dc2496926dbf8bfae87b7bf68a8b85c35d59c89ffdebb57c173a120e7f79cf476f6652ec196c96462aedd1fbbce0e7115af4f30db60f77a1bfd25afd49ca96e8e4fb0a59fc993f2d47db5deb99a09c3856b23aad1f0d9e9660ab748d8ffa02cffaf',
  
'q' => 'e78f4da096e328529e8ba99b3a568556413b34d390c05467bed875e76dbe8c55d8ab112392330588c513de956e126a578ee9a0c0f3b29e02a0da33b1ea69dbf3180faf127e003407c8fdb82f09d62d860f2e4c8353e86bd283a1cadc357a0cf66d795ce03fce630eb07da23eaa710edf8ac4a98dbc2e21a25e79556aa91ffb61',
  
'dmp1' => 'c17b2baf9aaf7e9fe9d5268c6fd0ab725b3872431c740a5b071d8bb9d9c38526d1ab53400bbd0dcc01de5697bd3bef06cfa8278231c61ba506ac7a00e5748f17f63b696df18fbd31c7da63573dcba21166c99ddd377447a51d58ca6737b00b1a9320e5f13e45db756cdf64f671dd0f9c6035cf6ed73fd5af5c6d70e6ee73d843',
  
'dmq1' => '547a1642e0e92c5bbfd589e1c48dae0542b4fbd7b7364354b9ee344d62df22496b4b356c79b8bd6b2122d7904260db84e7f159a12b06ddd86da04d3dba1c368ee01750b2795f4f9c0b7a6c8854995b704df78118643325aade34d75230fc3ee0641de3813825ee437ca5c8dbfdc85339c06170cdf17a0ef1327027764b0f0ce1',
  
'iqmp' => 'c4df94c42cae60195bea195b49a4c7ff7683202bc701fec0db134b1c373981d80130a2a2c2852b9d2d7aec7675beb5b341e251b8d4b0efc2d3b5948166aac7b95e7e41c0f454f4b09dcdea34003e4300d4c640a15a4d0462f5528b053faba07a6c8bd4f40cdcaedc560d56895945fc8ec00e935634ef6c97dd21156858df5285',
]
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