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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAssWquGG9pQneOmPsQsFW
0IcjvTC29XQ/AvGMC3KDeJaUBEBy7U5h67nNgYf6nLFWA5rnDxEKBvQsGaASZnkm
vPwcUpHPU1bDP6PSMhDondSx/0IRCYN8/UngBgR7L5u5HB3eXMsEOeHTywahbPHK
TLb4MIcvGxQhSlDzUM+tj9vquPZM7hDf6BYUbsDHBWTT7aoAJBZ42ztvUAr1DreM
XFanTgVmQkT2MX4wNCd+pL2ypSAC+d4cDFTZt9NGYSF6ymVOFR6RdMa+vh/xWfEk
Wnz0coHiqXuROPyA2qrTwCZ+ZgrcVwe4RtHpEa1Q6Wbs/cSPflX+BmiruOebTKTf
zwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'Ūa    :cBVЇ#0t? rx@rNáV
,fy&RSV?2ԱB    |I{/\\9lL0/!JPPϭLnd' 
"\0" '$x;oP
\\VNfBD1~04\'~  TٷFa!zeNtƾY$Z|r{8ڪ&~f
WFPfď~UhL'
,
    
'e' => '' "\0" '',
    
'd' => 'JȶFljG%_``22gZl[F.& P̳trӲQŇ @Vpl~`9jK1l551cё`gcK.!TK<WVHT\'%    =#1=ؙ ZZo^gaxL{W⯃VlT tŴN<Zy@&+[ӌ S= IYMiWbfV݅$VU؜-])ڪ@L',
    
'p' => '%6s\\ :7K3 V(!r}MiӐbaТ]\\V:" Ҝ}x0O[+6UoF&8`R=.`u
NsVT"'
,
    
'q' => '&' "\0" '֘ D4VD6#uȉA<\'/vI%c\\7rCyK%*(s7h5*cz.Z NcwS*d<hdW~G 3oa3-wr7',
    
'dmp1' => '4p5뵰q{Jo2O@ak!:lC`ËR\\WwO.xh.?OC߬8PVpϣn~o̿(',
    
'dmq1' => 'oYo[`+z]qZn
{t(23 s (>VI$xq0s=XX! 4\\ϫ>"K"/ONj    #.9nTY.;4v'
,
    
'iqmp' => '7qŻ0ͣ<ڣge(oF Fd, ݼv[o D\' asYM@9RВajB4 Sxx<[j uMS{n' "\0" '"q2II>}',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'b2c5aab861bda509de3a63ec42c156d08723bd30b6f5743f02f18c0b7283789694044072ed4e61ebb9cd8187fa9cb156039ae70f110a06f42c19a012667926bcfc1c5291cf5356c33fa3d23210e89dd4b1ff421109837cfd49e006047b2f9bb91c1dde5ccb0439e1d3cb06a16cf1ca4cb6f830872f1b14214a50f350cfad8fdbeab8f64cee10dfe816146ec0c70564d3edaa00241678db3b6f500af50eb78c5c56a74e05664244f6317e3034277ea4bdb2a52002f9de1c0c54d9b7d34661217aca654e151e9174c6bebe1ff159f1245a7cf47281e2a97b9138fc80daaad3c0267e660adc5707b846d1e911ad50e966ecfdc48f7e55fe0668abb8e79b4ca4dfcf',
  
'e' => '010001',
  
'd' => '4aa2adc8b6bdb7466c6a1247940325dc7f5f136060320fab32ee675a6c1fa95bac462e260d1ef950b1ccb37472d3b251c7c5870bca405670e06c7e60d0396a4be2316ce3851c350fe4e4df1f99e193eb35b8ecfb31ee9c631ed19191936067f21b63f8eee2af4bff152e210189fb544b3ce4575648fb542725e0b0049fffc51c07b1093dd4d42383f4c631f79a3da2a512d899d10d5afb5a6fda5e67e461d713c81be6784cb67b8a57e2af8356d86cf954dbcc0d747fd6c1c5b4cddef7b84e9d3cbd855a798440dbeb26cf2b5bdbfe0fd38c820c53123d0db2f749a81ec7cb594d695762b36656dd8524adb05655c0d89ccc2d935d29daaa9fb8c704404cd001',
  
'p' => 'dad82536735c0dc3dceac2eb3aca378a4b330db3c456c2d22821cb727d81ef4dc7c76912b6a3ee9abdbdab87c7d390e6a7cde2966261d0a2d55d5c563a22c20e0bfed29cd5f70e049bf47d78e3304f5b2b3612556ff215c1834626386052dc3def2e9960908aefed750a0daa994ea97356ec83ea9ec1b3a754ecbd2292b7d801',
  
'q' => 'd11fd2c12600d69820a10144ea3456a544362375c889b3894198c23c272f76499d25635c3706afcbe972194306de794b25b3a62aa2288d73fdd437bfccd2d16893ac070535ee2a63ac7a8d2ee75aa20b4ef895e3e363da77a353c02a64ed3c68d8d864c9577e0647c10520338516a7858e6f6198332d7787dbf1c7f0729537cf',
  
'dmp1' => '1c34e5bef9e97080c135a4ffeaa8ebb5b071991f857be54a6f0fc40832b30fa407cee4f51b834f9ab440011ed41ba9be80fc616b1ead1ad6120821819fa6a13a6c4360e40413fec38b525ce5baea9c1fd516f80ff908cbd31057774fa6e2a72e78689a2e3f13194f92d943dfac38de505670cfa3eae86e7e6fccbfa7f81f2801',
  
'dmq1' => '6f59016fa45b87e7826017fbe8b42b7a5dc271c91218f7c65a6e0ae5da7b740128323320739014e47f0d28943ec1105649e1c8d524787130d4733da7db5858f5d4c3210dce345ccfab93a93ed322b7eb4b8622d12f4f0890f11ef3cfdee34e6a0923d72e396eb9cb54e3f4cc59cdc12ee4b33b84bda334e4dae076f3f91ea893',
  
'iqmp' => '9037a0e88571c5bb30cda33c19daa39867d0fbc30691652892156f460c46d4ffdbdc13649484e3d92cf80df9f9a6ddbc765b6f20d544b08e27fedf206173f3599fa41d174dfb08d0c5403952f6d09211fcbc99d3f3616a42340b825378a40778bf3c5b6a0b754d537b6e002295eb71df3212f749eb0587e149f5a43ef99f1c7d',
]
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