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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxdvyR/vYhlekCPExH+Br
fvoTtSPC2hsab5eC59CWWpmP3rRUWt9bxzdqQoVEcqNSPkMXX1DQakzm9ShUtzEn
DT2KzeqPbTFcdtsfJ/pPEK0bd8ZHG/wE9bN5AEqURmjkFh9SYmrAIAqFGWeHoOe+
o6/cz4fdL/5fqBF4kaLBaBsdzKs+VLTA9t/YAJubR2zPjaEbjm1MBoENAN0s8X2s
sQRq4dpSSlO8B6Jstw4N5rQHjVua9T8/QxzROwSAvu3dI9VzszchzcjT2dWN8Hwx
J5mDMM4tm6Em4QErmZv7FwnBhXetRbPdYLcYM5/5unj0YXcSpSanBh7pZxK3brSr
qwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'G؆W1k~#oЖZ޴TZ[7jBDrR>C_PjL(T1\' =m1\\v\'OwGy' "\0" 'JFhRbj 
g羣χ/_xh̫>T' 
"\0" 'GlύmL ' "\0" ',}jRJSl [??C;#s7!Ս|1\'0-&+    wE`3xaw&gn',
    
'e' => '' "\0" '',
    
'd' => 'wReXTo[' "\0" '|Bp%@JYQ7,9*&kgQ~{} -ƨ    ؇[ &A^9 #Yr$"܍63olk̅c,:Zi^yhS7#Cx<dJtLsln?G!uˆ~ͮSC%4uHzO9\\w⪁.q6@.{( ">)8\'y{%(>    Pm ',
    
'p' => '@}k?FGetݕ0s{3gC6*X*CcPf֮7}m_^/yW?Y:Դ`&Lgc״+3',
    
'q' => '˴8I0 1+d-,;=k 2G?B#k.ب훱ktl}sXK!Ʀ,Q ,g2',
    
'dmp1' => '&SِbLJvl2)    ݥ| yEc2-t<*RK󡴵Ha:Z@r* BԷM4Di9-WwحKXA5Z' "\0" '>',
    
'dmq1' => 'Q5t.*pmvI2\'hd{`tγ]`u $.g丣CVtKjn@.    Zz~^a6/v3W8}
7f~1vyxv'
,
    
'iqmp' => 'D+pmCyk^|@qA^ xOJ%ÄM) Ȱ"' "\0" 'IXqKc&O|0WHMG
Ɇ&;$yƀӷu]>X.hOLt)sѢS,A'
,
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'c5dbf247fbd88657a408f1311fe06b7efa13b523c2da1b1a6f9782e7d0965a998fdeb4545adf5bc7376a42854472a3523e43175f50d06a4ce6f52854b731270d3d8acdea8f6d315c76db1f27fa4f10ad1b77c6471bfc04f5b379004a944668e4161f52626ac0200a85196787a0e7bea3afdccf87dd2ffe5fa8117891a2c1681b1dccab3e54b4c0f6dfd8009b9b476ccf8da11b8e6d4c06810d00dd2cf17dacb1046ae1da524a53bc07a26cb70e0de6b4078d5b9af53f3f431cd13b0480beeddd23d573b33721cdc8d3d9d58df07c3127998330ce2d9ba126e1012b999bfb1709c18577ad45b3dd60b718339ff9ba78f4617712a526a7061ee96712b76eb4abab',
  
'e' => '010001',
  
'd' => '147752d165589954d96fdf5b007c1b427025b7b7f240d34ae1be1f5951372c39f42aca266b9bed076751037e7b7d0c2dc6a8f3f2f50e09e0d887055bf5f30ca20efa9ba026a3d9d641a91ac8ecd85ed63920238f5972b124a522e007d6dc8d9f0236cd33c6ed06a36fef17c96cb86bfccc851fa66317c2cd2c3a5a695e1779681ddb53372343783ce964cd4a1e74d9cc4cb0dd73ac6c6e3fa61247aa21f4e3a775c2887ecdae5343fa25e2d6f5b71bbd92fd043480df75487aecef4fc1395c77ede2aa81cf2e7180e336ab402eb87badd228e587fc2083bf2207ebff3ed7cf29d2ffc11e38c82779a87b81ffa1a5cc7f14c72528d73e7f09f650dbead76d0bf1',
  
'p' => 'f8a7407dab1e9b8ff5bf6b11a63f4647076574dd95b0a991e61aad3073eef6a7df7b1003f9d0f7c73316e69afe14670643a4cf1e36b12a8b7fad8dc2c458ed2a1ba8bf43819c63e650e3d8fc66b5ea12a6d6ae37ced97df0c11e6d7f11fb5f9a5e052fa78a79573f16c059abf8053ad4b407aa60cad8264c67639ad7b42b0e33',
  
'q' => 'cbb48038ff498130ed20c0c80331c1a92be564bc2d0fea042c9aab8891fc9e3b3db5c46b20bae19732ceeeb888bd83473f4291f181b81b23af83bd176b9e17e9bcf6f3c92ed8a81b5b49ba99d8e6ed9bb1e1ce6bdc746cb67de0a073ee861458fd1a16a0de4bffb321a3c6a69114972ccf12f6d351120b92b62c0484673284a9',
  
'dmp1' => '9dc126f653d990628e4c4a76a11de5cd6c90decb328c299909ff04c007dda519ae7c9a159baa0b79931d4563322de98b1ce174123c2abcce524bdef3a1b4b58b108f4801613ac25abe1940722a0be21cc142d4b74d81c91834bdc44469392d5777ad1ca5d401d5eb8dd8ad4ba08858e1d7f2411335be5ad600863e17fa1392e7',
  
'dmq1' => '51358974af998f2e812a70908c6d76a649c0aed33227c90496ffa668d0c264167bf88df0a360bd74b8a5b497ceb3b6b55dabdd60e9750b24c3e1022e6711e4b8a343d4569d1d748f4b6a6e40cd2eeb0509fa5a7fb7a8967a7e5e61b9361b2fdb7633c357a8a7a5adb53884867d0a37667ebb31b976f579b5a8788de876f7b5d9',
  
'iqmp' => '442b706d4379106b5eb17cfaa440e496d571411f5eddc3208402784fe34a1525e4c38499e54d80290bc8b0221f12004994ee58e871e3e14b63e01d8ae1c6264f7c3057a785924812e74d470ac9861e263b93effe2479c680d3b7ec75bb8bc55da7c73efde1bde9582ede6811d7ed4fb44c8874d52973d1a253a4e42c41ab9b9a',
]
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