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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmeKnKGJU2NRyLVle3jSe
fQehPur5456UOoGUUYb6CIfdzF6ivxd6KWKgFflIW0Ugsx5cv599RHMBb9/u0nc6
lFt+Q/SRzLCdcD+0ErUH64+hjxpkZZXTr5sCfz9VyBHA1CzoyqlMvGjHpZN2nKX5
Xm1aio1297pKCgS+JwRP10tcWvF8ensRNwM05tHpcapvCxe9UK9umbtLtdsOe8kV
ZAY5mcyKhke4WxAKDBPxvjYKK1It+okT4ocooMBHVBsVkXlPviyWWk+Kc6NQc/RN
qvR/Vle8taRcxZrlI9XkaF6mh90BK6uyBdlqdCH3aLWUYNR3kv0LOyMHt1XoeHX0
CQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '(bTr-Y^4}>㞔:Q^z)bH[E \\}Dsow:[~C̰p?돡deӯ?U,ʩLhǥv^mZvJ
\'OK\\Z|z{74qo PnK{d9̊G[
6
+R-(GTyO,ZOsPsMVW\\Ś#h^+jt!h`w ;#Uxu    '
,
    
'e' => '' "\0" '',
    
'd' => 'L3c217i5^%\'Cw>q:EɁB}UHNb/5uXSA(uw`\\,|uvi#êTU>62נ,JGa@M e٫zō47JG%|eJK.LX/00|"?Y9}&,)ծ @=    aMm PMfH_a#7e    m"00sScn/;ג ewՍ',
    
'p' => 'T,`mo\\H>:-sn"0\\iCX?n(rꫪH rg7+a%hCD?%& j}X?laJz&y~2j-4f4w',
    
'q' => 'O*(~;MICd+di!R{gaC:/Vݏ25\'4h] /4:zysT9V/eoC4iޗjL(jK!_Ōߪin',
    
'dmp1' => 'vpUźw3SNUW˕iIs\\ETo?).#-;U8ddtTs aZt[uFyTDړxٱ\\-w3BfN[((',
    
'dmq1' => 'ש vg7 - a(X>)%E%tR<`و}Puߌe' "\0" 'f:hocG8tO,"8?&dyܖXC-V~_*/(l.',
    
'iqmp' => '<IÀ!Pa *mAPQJ#1Z|ڮ2 :a\' ab{>A̖b!~_Tnׇ4:-%hDAD}5ntrJGR',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => '99e2a7286254d8d4722d595ede349e7d07a13eeaf9e39e943a81945186fa0887ddcc5ea2bf177a2962a015f9485b4520b31e5cbf9f7d4473016fdfeed2773a945b7e43f491ccb09d703fb412b507eb8fa18f1a646595d3af9b027f3f55c811c0d42ce8caa94cbc68c7a593769ca5f95e6d5a8a8d76f7ba4a0a04be27044fd74b5c5af17c7a7b11370334e6d1e971aa6f0b17bd50af6e99bb4bb5db0e7bc91564063999cc8a8647b85b100a0c13f1be360a2b522dfa8913e28728a0c047541b1591794fbe2c965a4f8a73a35073f44daaf47f5657bcb5a45cc59ae523d5e4685ea687dd012babb205d96a7421f768b59460d47792fd0b3b2307b755e87875f409',
  
'e' => '010001',
  
'd' => '0f4c33d7d4e6a063863231e73769bdb3aa35825eb396c825ee27018a954377e3a1cdf63e7186b0f33a45b5c98142e97d55b1180148a6984e627f2fa0bb357512588215d9534128f18dbe1775a09f77f0605c2c807c84c775769069fbeed823c3aa940854553e36a0a7f032d7a0bcf32c4aecac4761e34096a9a64d0cede5cdfe1d65d9ab057ab0c58db4fdbb34adb237aaf6a04a47257c11a5e665ea86e7fa4a4b89bf2e4cce58932f3030cd7c223fb1b1598d397dec261fa8cefb87bc2cd929d5ae842040e43d09614d6d0c12504d668d485f61a2f9231d1e3765d8061b096deb22303005e8e71eaf9310e073531301636e2fe73b17d79220af1965a977d58d',
  
'p' => 'ccd9542cb460a4079d8e1b6d9ba8e1b76f5cca48953efc8d08bd3aea8a2dad736e228c305c698e4358ffb701873f6e0128fd917281eaabaa051ec0ba480dba72bc67f194372ba861e586259e02ad6843af0704443fd9252620ba14e5aa6afe7d58f2db3f6c614a7a2679a1ed7ed3c8326a2dabbc340ef866b613d834859f77eb',
  
'q' => 'c04f8d2ab6c028917ec73bec024df48e11494313c1641a2b64f56921c013ad527b67618a433a19f12fab56dd8f7f32db35887fd127d834e90eebe168e95d82208019beb7d92f34f303a23ab87ac5791d7354390198562fd4656fff89433496c169de977f6a4cff286a4bc4d321ccd45fa0c58cdfaa696eb4ebefe010a5f59adb',
  
'dmp1' => '76af98708a55cfd3c5ba7733cb534eebebeed418b7b815b55511e657cb9569808e981fa74973b3045c45546fe33fa1e9b4292e232d189d3b55da1a8a138338ba8f649df864fabb8574e983540873160cd914f4a8e2615a7fbbc874a1185b0375f69a46e37954e944da93f078dcd9b18d5c2d77ea04338442664e1b1f5b2828df',
  
'dmq1' => '9bcdd7a90b7693678d370d2d2090d7d961d7e128583e29958eade5071afed625452574b8f7ce52c63cc0ac17c4f260d9887d965075df8cbe65006617013a68fabbce1fde036f638e9f1b0847fdef8f3874ff7f4ff383a02c8c2238fd941d3f2664079ae5f7d179c7dc96965817c2432d56abb67e5f2a1c2f2817a788d56c2e91',
  
'iqmp' => '943cf049c380218fbb0350619e0b2a046d415007df1e51e5841acce5fa914a23bab2f011ca315a7ca68edaaee9ee9b320b3a8a0561b527060bee98a21961a4edbe628e7b3e41cc9662dc21807e5f548093e06ed787b1efd2ee34fc063ad02deb25b368dfe1bcd9cf1ef64441447d35bca66e04c374a39810724ac847520887ec',
]
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