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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxMllRd/wNe4GtAxkpF8a
AtJoOcsrz/aczYbpLE9EKEgN9tLWcy9ksIFX2PtuheMp5t6W//W4dlsAXVCq8gIL
duonyRQSmIMGqsu/lGD5LiSQVRTzsDHv1WhbttWvoculErjZl7XIhKNWZH05k01+
ENFEpWvTM/qMHOdtDhdaNUIHDp2/qHOPsS1snwBMXpjYoFw6/5dww3pfoMr4f4hS
44FsGvuL944eiCk8LbFRObm2uAaNe8s6LXlfrsrD7wZqlsvnbeNd5ITHS+ASRYBX
j6ApydkpNXkBZ9vkQy7LSMaYRUF9JtbGdny5Ypk2KnN90ATRLN0otTvxQhxWjDeX
HQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'eE5 d_h9+͆,OD(H s/dWn)ޖv[' "\0" ']P v\'˿`.$U1h[կ˥ٗȄVd}9M~Dk3mZ5Bs-l' "\0" 'L^ؠ\\:pz_Rl)<-Q9{:-y_jm]KEW))5ygC.HƘEA}&v|b6*s},(;BV7',
    
'e' => '' "\0" '',
    
'd' => '݋\\֧RFgb1C\\ <]f2q팳Vָ޻ }(#]C/z=͝V' "\0" '\\F|qo!5i]"TaynN<&?o$H̹!
\\3jnb17C?!yJ7(82\'ϟu]^#j
ɘo29-Kyur=nl SScJ!'
,
    
'p' => 'u>J98Պ"!tx]s旃.eHN=C!ۓKM-R+l8$i8[ovuH6^ċRk9 e7MC3%',
    
'q' => '
zny"@g?nsf4McE+J P3򂈅f>oΛN{Yq6 ?xR    <*zz(E'
,
    
'dmp1' => 'pk$ɄI4\'' "\0" '^
P58׆$ێ;xl M}dE2IC=^ eِPpOm%,5H* B;Rd)W<QC2AH;DŽ׉'
,
    
'dmq1' => '_1ϯ}' "\0" ' ,lhKzaZ
|    cA,:DJj8dQ{' 
"\0" 'U?04nH8nfcɛS18>ٴICQt7 Ke\\4    Z.#    Mj',
    
'iqmp' => '0*4BxC 1-|+>⪛    @Y).|!:uv(W B&rǏ4-5Za
Lgq\\$uz^q,ʬ 襠8ZE!:5'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c4c96545dff035ee06b40c64a45f1a02d26839cb2bcff69ccd86e92c4f4428480df6d2d6732f64b08157d8fb6e85e329e6de96fff5b8765b005d50aaf2020b76ea27c91412988306aacbbf9460f92e24905514f3b031efd5685bb6d5afa1cba512b8d997b5c884a356647d39934d7e10d144a56bd333fa8c1ce76d0e175a3542070e9dbfa8738fb12d6c9f004c5e98d8a05c3aff9770c37a5fa0caf87f8852e3816c1afb8bf78e1e88293c2db15139b9b6b8068d7bcb3a2d795faecac3ef066a96cbe76de35de484c74be0124580578fa029c9d92935790167dbe4432ecb48c69845417d26d6c6767cb96299362a737dd004d12cdd28b53bf1421c568c37971d',
  
'e' => '010001',
  
'd' => '16dd8bddeda25cb1d6a78f1516a0524667aa62a4bfe77f3143145cfda00c3c5dfaf9661032fc1bc8028f718fed8cb3138856eed6b8f781111bdebbe3d110f9c20c7d28f9231c03857fcd02eabbc5d85db9439996a32f7a3da2cd9d5600fd5ccb467ca213e5b471ed04b9d26f21358ce3695d7f9722c85461796e4e96a791fcc405e5bcfc3c26bf0e1ceab43f6f24b4bcdb48ccb92101b40ab9d05c99bd8cf7c1bb88f7336acb6ec010628231eee18f37431a9d3f219979c7d84ad7e2a6ecd2ffb437d5048b28a1383284939b942787cf9f75865dc5f9845e236a0ac9986f8d3239ed2d4b9b0e84087975723df47fa7acd36ee7fa6c1cf90cca53aa5308634a21',
  
'p' => 'f6fd753e8082fe4a87b5c739ba8b9738d58a82ff2221870674dd7812d51d5d73e697832ea0f165484eac973d9343a97fdc21fadb9384a1f0fa4ba6b8044d9a03c3fc2dfa522b6cc8fb3824698c38155bc60401a8aa1af6e36fae76d70e98e6e99ae8758d489536f2831d5ec48b526b391abf20e4651437a14defc64333f225f9',
  
'q' => 'cbf71bbb0a978a7afcb0959c6eec97f1c079f9d3f51022400413049067dd3fc66e0fc4efb6736634d217bcd34de88363d4f145d42b4a1401a9a620f7a8afea50ff89ed0233aa9aeff2828885663e12d46f81bb929d95ce9bf9fc9b864e7bd0e9168759711df536203f7852a6afd51a093c05882a7a968d7aca08b98f9b28f345',
  
'dmp1' => 'b5ada4a370066b24c98495e249ecca349d2700cac9015e800a50aa35381c1c94d78695912403ccdb8e3b78186c0db64d7dd064e54532a7a84984824313af3d5e0db89edd65b9d99050f2701e4f6d2590d72c35482ab020f1154280da1a3bb0871f5264bda329573cb5e351c5433241fac448d8da07dc023b9dc784d00412d789',
  
'dmq1' => '5f82c2908ec031cfafbe7d00b90cbf862c6cb1e9684b7ace615a0a7c18b70963412ccf3ab5444aab176a983896b5f7b8eb0164829b16e0517b00d9553fbfc8c8cf30e6346ebf48386e6663c99bfc1b5331381dfee51e3e96d9b4499bd5eab30443517437bd20938cfc4bbae0655c3409f8fa5a2e1223a7f2c4e2db09fd4d6ac5',
  
'iqmp' => '30a82ab9ff34994278430cbf31f7e6bdf5f22d93d8fcb97cfdb4b32b9d3ee2aa9b0940cc59292ec81b7c2189cd3a9775b683acaece7628bd57f80cae8e422672d7c78ffee334e12df8c2e235165a610a4c9da767a871875cae0712f124759e7a5e71a996e02c9acfcaac0de8a5a0b8e0889b385a8f45bb21803a35f0abfee9fe',
]
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