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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5eRIwU66Fo3Z+jT5t781
ZwNZGgDnvwhKluHQ4dlIrYsL/orAHHgHGN3XXtcP8GQ3ZqI0S+P6P5m/MKYr2XV8
FxSYbDmsUED3ZsgI+vJuU91UjsAkrbOSY0ZbjLXtXFywdpPMLHrBf5RzLegaX7SS
JwSGbV3sgmIm6seNmWNzvcCa6KqxC0uqaZCLcohjTFbDh0Y5Z0ybxinBw4O8gJMi
945z2zoiPAxq0rW5dofesVeRXr9RqFOktBOYlCovyi+KPbUvNrRxifOBgrok3AgH
sH6Y/WLVfNEHfqgP8tL5vvJC+/71AqcULnMrnS8VeMbyJ5Aor+tLEG8h9xI/l8Gn
LQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'HN45gY' "\0" 'JH x^d7f4K?0+u|l9P@fnST$cF[\\\\v,zs-_\'m]b&Ǎcs誱 KircLVÇF9gL)Ã"s:"< jҵvޱW^QS*//=/6q󁂺$~b|~B.s+/x\'(Ko!?-',
    
'e' => '' "\0" '',
    
'd' => '
I< p15"BPD#+, Co A*]Z=D]p$+e9&f>' 
"\0" 'UkQPSyw z(WK{
}X|FuCX<JǸWa?d": +Mdq(ga\\9 ( T%|g:mh=~jBﻤM0Mт*X;f񾹄t@#_ޒ Yex$=jAK'
,
    
'p' => 'f62Δ;uP;?hGS$Ѿ;"hØbt}$6MeǞb3ʔ2G_k^g1齃~' "\0" ':3B 4%$!\\Ȕ,Qx4Zk9Óo',
    
'q' => 'dq9̤U uOl}Z`4l4SC@S N0boqW倞۫%{. 8D7U@iXI2ahD?%=!{!<؊̅+772O Bz^Ez;',
    
'dmp1' => 'F)' "\0" '$W=ʼnaʛ1aP1I1uEwxG.zW7NqQ3iI2_OxՈ-w&{k
rاQC?OcfA\'Qufßjs'
,
    
'dmq1' => '"Uʖ$(7w%, 4wdz PL 7ރyE$gbڜu%.szQj߮t nb` ݶEq-' "\0" ' *$xvN',
    
'iqmp' => '\\ZP{*#P㤦X+:llkMjc.R`.Z^?0fY٦a7 2WLF SSk1I&Po&%v la%=5"A+s Es/d',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'e5e448c14eba168dd9fa34f9b7bf356703591a00e7bf084a96e1d0e1d948ad8b0bfe8ac01c780718ddd75ed70ff0643766a2344be3fa3f99bf30a62bd9757c1714986c39ac5040f766c808faf26e53dd548ec024adb39263465b8cb5ed5c5cb07693cc2c7ac17f94732de81a5fb4922704866d5dec826226eac78d996373bdc09ae8aab10b4baa69908b7288634c56c3874639674c9bc629c1c383bc809322f78e73db3a223c0c6ad2b5b97687deb157915ebf51a853a4b41398942a2fca2f8a3db52f36b47189f38182ba24dc0807b07e98fd62d57cd1077ea80ff2d2f9bef242fbfef502a7142e732b9d2f1578c6f2279028afeb4b106f21f7123f97c1a72d',
  
'e' => '010001',
  
'd' => 'd50a49b6023c06fcab9ce80ce68fe67031351818f0aa2287e4ed1d42beb65044c3f7be232bfebb2cfb2043fe6f01ea0d412a5de65a3da544d85dc01070b4242bcb65391df526661e1efc8efde73e00afe2556b9051fc505379770b9de87a28574b7bc9c10a7d58ba7c46758a4358b5fc3c804ac7b88e5761133f9c64223ab7030da90890c02b4d01a2ab1f64ab977128e8fe670f06f4618f149b88dc5cc2f1e1a3390c281cc0e4feb11d9a0d8fff54e1a425f87c673a6d68fded3d917e6a9d42d3c1faefbba4b84de3308ce34dd1822a16589f3b66f1f1beb984ccf795a7aebe748b40f48823a00ef28b5f99de920bc0bbd859657887d0243d6af341ca4b9bcd',
  
'p' => 'f366363287dbce94843b75503b3fb46847871aca5324d1be3b221768c398627499c17d2436fcd44d8465c79ead62e933ca9432dd1f940e0e475ff9f36b085ee467311ce9bd83fa7e00cf3a8f0233d5e34202b00b34a1a4bbce2524215cfbc894b8e3fb2ceaec51ea1578ef34b0bd8d5ae417136be4eefbd939c3938ac7166fdb',
  
'q' => 'f1cb0e64191ad57139cca4e655f80d754f8e6cfad67d5afe8894600ea2e2e434026c34534340531b204e81b192308762eb6f718805a957a21ee5809edbab9925107bd72e0b38dc44fe12379855b9e8a740695849fbaba9326168443f253daa21147bbb213c17d88ab4cc85af2b3737929ec1a2324f0c93427a5eae457a3b1797',
  
'dmp1' => 'a846290024573dea05c589a48f61ca9b31a0615031cd49c8c7df18ea1018013175bf84820e161bbcffe4d1ee8d16cdfd4577d1f6784786b42e7a573707ef80934e187151d3f933abfb6949a5e732e913b5e65fc94f78d58815cc2dbf77268794f282837b996b0a72d8a784511c43e03f4f63f8c46641271316517566c39f6a73',
  
'dmq1' => '221716f855f1ca9624280e37cb7725ae9c80e02c9d811f0b3406776498e2947a20bd50c34c800d378dde83ba9d79ea1cb0450e24b767a0cb62bfc8da9cee1cb1751980c5251fe72e7303ee82b3d37a51da6affdfae740d6ee4fce66260c5c8eed10c80ddb6b345fc88712d87fcf7d406000c1cea2aeb02f82478a4e976ca4e11',
  
'iqmp' => '5ce85ae250d47b94f5ad94191d2a2350b2fe1e86d1e3a4a67f58af112bb404b73a9f6cc96c6bbd4de76a6394da2e52602ed65a5ea5e4c015b2f7c63fb230d3661559d9a6613720e632574cd0dc460d5353c06b8931074926ec5008c56fa3aca5be10aa26cd25760da66c056125039c3d1b35ab2241822b7320457394962f648b',
]
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