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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdzOFIIVqhZjmXhbKlB5
kXQfP+Wuv0Q3vusDl20YFM6GX99lxjPczrKI48cYbSeSeDaHDOh9m3huksjTQEoH
6Rf5Nt1QkjkCw9Cy750S9WfA8qbA6fbT6iiFhYzJiZlCEVbrjV362ONqnWeJURmY
fCAjXmGG7ffiSuZt1/msHFVNiQwy6mALCQr16BwTj9YDyLNJF8miVdicODDJC9X5
1R4cXFK24Z/SbO6tM99r9GUAn3Db/c7TpRRfAtcPz+EslxUrrfwEfkr7pd/rN4D0
fEl8j7a3Fi2+gofn5sEYR3KEAGpA2M0rM2qDNz7xI2Azd8yyJSK22QAcPpxJE8dc
JwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'cx[*Pyt?宿D7mΆ_e3βm\'x6 }xn@J6P9вg(ɉBV]jgQ| #^aJmUM 2`     
ȳIɢU؜80 \\Rl3ke' 
"\0" 'pӥ_,+~J7|I|-Gr' "\0" 'j@+3j7>#`3w̲%"' "\0" '>I\\\'',
    
'e' => '' "\0" '',
    
'd' => 'vYV%EYn#=Ecaam .+|suԨQ[ N)M̶@|.sCxC3av.·' "\0" 'p<H*V>bauY$uer@.' "\0" '
KՇ~yh9Dr\'Ls;    fA?QLÒ_}_n6!vAq,)9Cz-' 
"\0" 'e)>jY5Szb$1HSXiA',
    
'p' => '҆8)i,RO6N03-9;o(M+Hlŷ&d=lcC>](;ـ\\V%U
6Xnɡ f>g%ᯘA]T<N'
,
    
'q' => 'ɰժ1@gҪZXṽStĤ2vX{@P٣&tފ,1CWƓŸޭr8Gŝ^hQWp =ſP',
    
'dmp1' => 'E)' "\0" '/l~QB\'.}C3L0R òPs/@`!WQA.&b52[ZKIZNzw5/&cJpۅPlΔBG_#Y',
    
'dmq1' => 'w˒o*_f֬Y3D6׈N|Ȑ1:!yYp}%
NZZ.kr;w!ew2D)R)˷h"T#p6?['
,
    
'iqmp' => 'P?"2$ozU~#OzYW 힣d
    \'Qd TvٱuJ1    K<˻l6`8cP&/^' 
"\0" 'I>-F>',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'a5dcce148215aa166399785b2a507991741f3fe5aebf4437beeb03976d1814ce865fdf65c633dcceb288e3c7186d27927836870ce87d9b786e92c8d3404a07e917f936dd50923902c3d0b2ef9d12f567c0f2a6c0e9f6d3ea2885858cc98999421156eb8d5dfad8e36a9d67895119987c20235e6186edf7e24ae66dd7f9ac1c554d890c32ea600b090af5e81c138fd603c8b34917c9a255d89c3830c90bd5f9d51e1c5c52b6e19fd26ceead33df6bf465009f70dbfdced3a5145f02d70fcfe12c97152badfc047e4afba5dfeb3780f47c497c8fb6b7162dbe8287e7e6c118477284006a40d8cd2b336a83373ef123603377ccb22522b6d9001c3e9c4913c75c27',
  
'e' => '010001',
  
'd' => '76b4a8e91490dcc25956254559eb6e96233d9a458fe363b761f46105a7166d0dc22e2b7c7375faba141cd4a8515b0dcf4e29f84dccb6d8e6407cdd2e13fce7dc7343f1784389e3338f61762ef783f20ee790c2b79ebb00bfbd70923c48a12a0696d256933e87a162619375de5924b07565aaea8972402e00cf0a4be31ed587107effe7c619a7f3ce79b6683983eee08ce74472274c13731dca3b09c466bb94c9413fe5514cbfda03c39297f05fb27d191de75f9a6e843692ff21d2efc77641dd712c9692b229c23943f47abc112dfadf00820165efd70429d53e6a59b1e716e735ee537a8e622431119bd5081306bb48f053fb58f8f76981cc11c9068eaf8041',
  
'p' => 'd286382917aba2692cbe524f361c4ee630f2331e2dd5f7393b6f1e81928128f5964d9f2b9c486cc5b726bdf2c717bd1164a0fb893dc46c8563433e5dbfc9287f3b1ae0a019cbe0f4a1c0fdd980ad5ce456e72555b796b5b1010af9a8e0365804b2fce56ec9a10c98663e6725f4e1af9841f0cf5de9b8cd54d0f13cb5fff24eb3',
  
'q' => 'c9b0d5aa311dbd40d367d2aaf5985afea2e1905804e1b9bde9d753dd74b3fbc4a4f7f716801c3276587b1140878650d9a3f02674f2f5b8ddd0de8a2c951ce531a4c1020243df579706e6dae7c693f3bd8607c29f9adead72e29838fe47ecac10b2fc9190c59dfaf55e6851a057a6b1700d0cdb3db3c5bfe7f4c8f513b650b6bd',
  
'dmp1' => '45f029001dc8fb2f8d99bca66c07837e9d8c18c751dadf42b827f62e7d89431e334c9e3052bf0cc3b250c091c2ea73f92f40fbcf6021bd1ba31a57c1b551128f12079fd01041d6fdee2ebb2662c53532f65bdbdf5a1a4b49fe5ab30e134e7a77352f26d9634a8970a7a6db859490d550f3b7186cce94824247179d5fa923ca59',
  
'dmq1' => '84771aedcb926fb0fae80e89f0019f89ec2a5f661fd6acea5981edf7dde533ef443603d7884e7caa1394c890ec31c03a211ce1f51f7959707df51b250ace4e8d9b5a945a2e7faa846ba9058f02723bbc7721f3a665cde87732f1ad44fcb229945229e5e50295aeb4a6cbb708ab68b4d3160f229354d605237036e817893f5bb5',
  
'iqmp' => 'b388503f8d22f9bfef0732241c6f98b797b57a55ef017eae23fcf64f7acff5595720a71aed9ea3640abdd5f6092791b25164acf9b5a4cb0c54b6ed87f88476910391d9b1757fc24ac931b2b3091a054b183ccbbb9b6c07128436b5f09bfcd9600eb4d038b98663b914e3c5e95026ca2fe2d35e0049c33e2df046f51d01123e1e',
]
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