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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdiLm5+otxE0eFT5qJD3
yU7wgxiXt72hfqJjEt6DZ64j9GpKluSnfDVQvkRkoWwgdZ1CqAUe37udGJPfwo2k
5vGi+26Wd7FjucNFkhJv5U4XmplyytZ0SM0gqC0c8yGgJwobIvuLZXz4shIULYKb
wfcNoqwHI3qzJd8ZPn878WL3A4I0H3Y0RF2nFHDV2lyaE5VmC0nZSBut/qNIQa2W
uo2JSKw2/CyGlQK8SW9yHF25bDka5hiB5Wa1mQlcmvHpU1xVlIt1sueTuhd54TxK
ZIdMKGxPDFwEp9zA+qxkfgJw2BXKUwzaqtHAZcduJKQ+T5T6WNWJ5BDeY8aAHfFu
bwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => '؋4xTN~cރg#jJ|5PDdl uB߻nwcEoNrtH -!\'
"e|- #z%>;b4v4D]p\\f IHHAH6,Ior]l9f    \\S\\Uu瓺y<JdL(lO \\d~pS ڪen$>OXՉcƀno'
,
    
'e' => '' "\0" '',
    
'd' => 'q̅Jeǟc&;<\\rYD*>qMP<^?јO/>Ek-o?cSat:"꺩J8QE;b~tj!ZN2l=OBraG6[-D%(1UjX:9N^r/eb@:2R%DO(ƍOO1Bs|m;?DSӳl?woCؚ4PH4UshUWYQ^bgĪG^-=vϵ_}f^h`D֬9',
    
'p' => '"L?NJ Ng#K^ hrÌSp#H56LUx%m_2v0R?w|o7]./㣽<    RNrgI)|!(0xvT    <m|ARwQ=\\Oȭ',
    
'q' => '33Ҧa˃Ž!hl' "\0" ' Qc `B^E ' "\0" '@u:MEBV-?NN,lJi]ޟE"߻D.hػ7Lo}! ',
    
'dmp1' => 'v(3qoͳe=6#544YrW*fջM1`И\\O^"߰w-__m@3<bIc?i!Cѧ|.>\\
-SOVNO:/&='
,
    
'dmq1' => '9gЙ_L83cxL=LDbϤҡh 亏<fb]0I—?=  DS@t}0F-FiOp߼q"B;0 \\$Qi Io-',
    
'iqmp' => 'Csdf9S' "\0" '>bihސa>cHkɲ/li{FKQ2*ƻ9nC%-0$ Moqz3u{I?QvNC$}"',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a5d88b9b9fa8b711347854f9a890f7c94ef0831897b7bda17ea26312de8367ae23f46a4a96e4a77c3550be4464a16c20759d42a8051edfbb9d1893dfc28da4e6f1a2fb6e9677b163b9c34592126fe54e179a9972cad67448cd20a82d1cf321a0270a1b22fb8b657cf8b212142d829bc1f70da2ac07237ab325df193e7f3bf162f70382341f7634445da71470d5da5c9a1395660b49d9481badfea34841ad96ba8d8948ac36fc2c869502bc496f721c5db96c391ae61881e566b599095c9af1e9535c55948b75b2e793ba1779e13c4a64874c286c4f0c5c04a7dcc0faac647e0270d815ca530cdaaad1c065c76e24a43e4f94fa58d589e410de63c6801df16e6f',
  
'e' => '010001',
  
'd' => '0371b0cc858f4a65f811fba9c79f6315f226ba823b3c5c9acaf7725944f7b3a2812aa53e714dc450a706cb3cbe5e3fd198bfb04faef38a2fea3e456be32d6fdc3fee638c53619ef4743a22eabaa94a38c9f2b2f7185145cef13b99627e746a215a4e326c128f3d874fdedad34272b0eb61470e36c65b2d44252831ed03556a58dc3a394eec5e722f1c8c91bfe865a96240b33a3215522544f24fba949428f3dac68d4ffd4f3142b4737c6dafe03bf1033fe3447fe9cbd9fcf20153b1d3b36c3fa677d6e66faf43d89ab291eb345048c1345573688555ce57599c8751125e12e3626794c4aa475e9eafd42d3d76ddec1dcfb55f7ddaf2bec0665e686044d6ac39',
  
'p' => 'd5221ad8e64c3f16c78ae6f5cd1c97bad70dbfe14e0467a887eeaafc0eb9dbd0239b4b5e0bb96872c38cf7537023483536eeedbd4c557895a8256d8aadf4d55ff89132b1763052173fbf77c8e6017c816f379a5dd92e0f2f19e3a3bd3c09c1ecd4524e726749298f7cc62128307876da54093c176d7c9b415277513d5c4fc8ad',
  
'q' => 'c733b07f9633d2a6c561e7cb8315d6f207c5bd9e21686c001cb7f5fb8de41d87961daa0cad5114a31cb8b308d26318c7181e0b60ee42fb9e5ec5450c0e880683f4001c4075118d3ab04d4542562d3f9806d718804eaec5c04efbc2d72c6c8e4a695dde9f03451f2204dfbbc1442ee868b7cbd8bbf68437dacf4c6f7d9721eb0b',
  
'dmp1' => '7628a333ae7184e46f19cdb365d43d3623358734345972d25711f50f2a66d5bb4d9231b560d0985c4f975e228edfb08f77f5fc2d5f1d5f6db0bb974033f2b13cb48462d3498fbe630f3f69fc21af9f43eed1a7adf1d27c2e83aed53efb02f9d4ff5ce60abcc22ddd53b24ffd84e9b41294564e4f3aaec32ff2b51d7fe426833d',
  
'dmq1' => '39ac0f6780f713ffd0999de05fdd4cd3d9c83833b5fc63784cd83dd14cad449762b0c7f0cfa4efd2a1981fcd680be4ba8f92f33c66fee196625dbeb5d4e730ebb712e91b0849c297c13f3dd40cdb20d444f6b55340747d30462dc1a546694f70dfbc9b9d71f6eb229042ae3b30205c8d24d951b06998b20b198549aa14bd6f2d',
  
'iqmp' => '85c54373dcd064cae8fe663953a1a5c3c41b8200f0a23e626968fb1fde901d80ed8b613e63f3fb48961c6bfd03a3b2d8c9b22f6ce569eb7b9046cb4b51d7322ac6bbed396e4325822da730240c4d1cde6f11fd717ac5db33fbb51698abdf17b29cea7f75cb0519cc0eae7b49f83f5198c17616a64e8992f9f04324c17da0fb22',
]
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