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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwcZYMAhuRU1Gl36NGoi4
Ljb2Oo3tEXu9iUp0Nx7W9FlyyYgVQeSpR8v9ky0r/RzO0HZLbcxVb56xpiIQ7HYx
JlnKtr5LatvWMGamd01NgV5UZs8USY6UclfYkH8C4J+2sMU2/gAcBVz0UydlgcPX
wwTfAIeq7uVIQ7eg2eu7rDfJKsQZ1jztq81xAOZkl2mK32AZyT5C8zUWxOMCJWEG
wFZpZp6BGLuQro1JUHDvhxDHk7VZlRuGUQKaZLYQ/6UC7AH90f5Baow18Df3OHuq
8gA2PRdCjj5thz7oiR+BOGBDLzsdNNu9uaRqh67P4vhd3PcCOGJEonav/yeyYewg
NQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'X0nEMF~.6:{Jt7YrɈAG-+vKmUo"v1&YʶKj0fwMM^TfIrWؐ6' "\0" '\\S\'e' "\0" 'HC뻬7*<q' "\0" 'di`>B5%aVifIPpǓYQdAj578{' "\0" '6=B>m>8`C/;4۽j]8bDv\'a 5',
    
'e' => '' "\0" '',
    
'd' => 'FeS<҅v؁+߉cv4uEru[,z(^uPoUOfZ,X
0U6MZ^]>J0b1Pm K    `k!\'g=i7h_`%? U . Oi꼜bƸ59' 
"\0" 'soKUt|{c    f2z愐ңؘ*6K汁l=EGD ^8sqe /P@Oc',
    
'p' => '"[ ARq+ѤKwb-l_&5PE_4Z9iM' "\0" '|E-hD&SgC3CGkM=z\\U?g(39ؙ"&$e',
    
'q' => '!%' "\0" 'Kot7䈛80|fU;E0XZU ylӬ    nJӼԣV){
T!,2eq
(\'FJK?jƩ,fJ).++AmossCkQ'
,
    
'dmp1' => ')誷-,i|cc@Zơ^C!(.!Y6<ǰjHpouח[+p4X' "\0" '8[S4}Ӗ&#46T%E9 %uAF=,V/|12bj_[(m',
    
'dmq1' => '\\$1D;6Bo<UQ!|h-NT9qT_tl{P^B<Pd2[CZ]8e8\'T%
2 raQ`</*ztZs{~7j'
,
    
'iqmp' => ' _ؙd JЈZgӋ#l$j4е~5%K:    i j$t`CRMrܵ-}xX<^hZ5Fdn\\k*v)%4ٚj' "\0" '',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c1c65830086e454d46977e8d1a88b82e36f63a8ded117bbd894a74371ed6f45972c9881541e4a947cbfd932d2bfd1cced0764b6dcc556f9eb1a62210ec76312659cab6be4b6adbd63066a6774d4d815e5466cf14498e947257d8907f02e09fb6b0c536fe001c055cf453276581c3d7c304df0087aaeee54843b7a0d9ebbbac37c92ac419d63cedabcd7100e66497698adf6019c93e42f33516c4e302256106c05669669e8118bb90ae8d495070ef8710c793b559951b8651029a64b610ffa502ec01fdd1fe416a8c35f037f7387baaf200363d17428e3e6d873ee8891f813860432f3b1d34dbbdb9a46a87aecfe2f85ddcf702386244a276afff27b261ec2035',
  
'e' => '010001',
  
'd' => '46e6f865baeffe53a43cd28576ec07d8812bdf8906f19ac16376e6c734759abb101145c5e17275ae5ba9d12c7a28075e75509390fd6f55844fa4665aa2eb2c58c80a308bb8b4c4f3be8a10e71e55f9bc364dd7ffa85a8f5eb75dfaa13ec04a3062c606b531fd0ec9506d0cc14b960960c66b829a21a58027ccff67cfd53dba699baad3013768b0fef35fa9138b60253ffc871f0b55cd202e20a506d9e44f69e3eabc9caaea6297c6b8351539f800736f4b55747c057bb263a809c0aa66b432f97ae68490d2a30fb6c2d898d72a364b8caae6b181ec6c3da0d9454744e90c5e3899afaf73d571e2bd650d2fb850a8ece7401bed050187854ffb86e68063027f01',
  
'p' => 'f0a8228b5b04170212c51b0cf741eb52712bed88d1a4fa84194b9b909e771481a0622de8cfe5826cee5f26355011d7f7af45ba5f345ad739694dffbb0001ed7ccc0f4583a5fc2d8168c144265367e1a34317338443cc476be54d3d7a5c0455aeccf10f3f0e67ac2833f1b504ecdf39b0e2d899b30699a0a8972226241dd665a5',
  
'q' => 'ce21072511004be26f0f847437c9e4889b38b4307cc0ec66adedb0d81b553bc90f4530585aece9875520b69c13796cd3ac99fe096e4ad3bcd4a3b68a56d2ff290e7ba10a54212c32b365e9de710a28d7f527464a4b993f6af2b6c6a9a42c664a8cea29f388d22eb2e09f8bad2bb92b859841071b6de56fa3fbd6737343126b51',
  
'dmp1' => 'a829a4f1e1e8aab72d2c84697c01991163b9816340b35ac6a1f25e4321282eb121c459363cc7b06ab3ead3051fed480f706f75fafed7975b2bc57034589e00385b53348cf8988da7c6ee7dd3962699d9fe90a0d40498233436e7d154c625d545af39a720b5cd25d475efa94146cff93d2c5694982fbd7c3132628f6a5f5b286d',
  
'dmq1' => 'c45c2431443bd30e369c42a26f8ecd3cf1191855e451e8217c68a48189b02d4ec05439d4c17154998e17a6bd91b3a75f11da746cc97b50af5ea5423c10afd9506432935b827f435a5d19a5ab3865e438ad9a27549925b88b0a01e1c832d3f4f1e9c11c0b99f817726196baf95160893c2fa92abb0f7a745a738a7bda7e376ab1',
  
'iqmp' => '0bf98bde5fd8996420994ac0d0885ac467d38b1517236c246afdedf134d0b51dbe7e913525c4cc4bdb193a09690ce96a05249ed41174aa60e443dfc4524daff89472dcb52df71d7d781bb5e9583cb95e7f685a35a881a4cc466415ba996e9b5c85a9bedf6bd32a769687299688b1821825349dd99ab6e9cd146a0014c21b1f16',
]
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