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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6VW0dP781KZxlEDPs7Ve
pXeYA7gwj1NylndohDaTQoDrcK2+JX/27h78YxW/g8sSwFM+kLM9NlA4MJ/PEMJP
EoFYaKy9sFV3ZNNYI2ADs9GhqEH9jf/CVdGvv4wAKZZlWzNXx+KOt4fF5eVbN4pl
F7pQF9fZupffDyPHQTIeewHoHmVdhxMnVJkZcc3AKKIkx1fTktZ4S0agLjUdNeZS
fkyFPD5NZ3YiPNAdCuft0OTqjaNZUfQ4bis6S4efy8kyrQ2zmPIyxXEjAJH4AAxH
RsIUodlrNM/HwzzxpeUW5EkSYikDUWQG5xMu1u0cT4+OfZbNACX+3FL4wPHL8Qc6
0QIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'UtԦq@ϳ^w0Srwh6Bp%cS>=6P80OXhUwdX#`ѡAUѯ' "\0" ')e[3W⎷[7ePٺ#A2{e]\'Tq($WӒxKF.55R~L<>Mgv"<
ꍣYQ8n+:K2 2q#' 
"\0" '' "\0" ' GFk4<Ib)Qd.O}' "\0" '%R:',
    
'e' => '' "\0" '',
    
'd' => 'Հ44:gik%]J&U-AF~%Pu55\'cSfs?lQd~^Mv"[pL58$
(hC<7V28jX(s!LΩ$Ϲ~mǿk<AF4xlUק1a)\\Z㎊x^ +mKjniOY3*c<T]nՃ3м%@AčN9? Tw 9'
,
    
'p' => 'X{\\ddy0g.ݪK+;H~ Va3$z{/6ݎݸZ!xzԴ7Uz/;NdN< ;',
    
'q' => '\'i)a1},V!oLk|vrR9jC$yD?w_d%ƛ6ɮNp֕axPVZ⚱:zrƣ"lyA9J5wB&_K<#2/_
]jȕ'
,
    
'dmp1' => 'R xz\'jL3V[YOZL&|۠o[jjRP")B;&$W(Dp A"Lb!%fZ咇js^ 5*x|<ݷNERxQ',
    
'dmq1' => 'ϧFۏ;3zbG"9[U`Chuى =`Bk̠E` U[u?WK^S\\li\\v=XTZjl]wI|pV
Yn#'
,
    
'iqmp' => 'o,39%Rw ~`U9⊜u*_iTr\'PAsǧ3 I?/wޛgf1GpM8uoliPs"iO~=     xS7[^!;*j41:',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'e955b474fefcd4a6719440cfb3b55ea5779803b8308f53729677688436934280eb70adbe257ff6ee1efc6315bf83cb12c0533e90b33d365038309fcf10c24f12815868acbdb0557764d358236003b3d1a1a841fd8dffc255d1afbf8c002996655b3357c7e28eb787c5e5e55b378a6517ba5017d7d9ba97df0f23c741321e7b01e81e655d87132754991971cdc028a224c757d392d6784b46a02e351d35e6527e4c853c3e4d6776223cd01d0ae7edd0e4ea8da35951f4386e2b3a4b879fcbc932ad0db398f232c571230091f8000c4746c214a1d96b34cfc7c33cf1a5e516e44912622903516406e7132ed6ed1c4f8f8e7d96cd0025fedc52f8c0f1cbf1073ad1',
  
'e' => '010001',
  
'd' => 'd5800434a1343a6769b99b6bf1255d4ace191c1e26e09e1c552d4146e8a0e9d3089afb7ee6d525de501fe391fcc0dcc9758d35cc351527635366ba733f046c51a4647eb2c0865e4d76c622f98b5b17e812a0e070dec34cd035a33803240ae9802868dc431b3c371656afbaa33238c1b36a58ead82873218f8a4cd47f051afab4cea92405cfb97e6dd7c7bfaa83a06bf316823c41f54634786c55d7a71a3161c18b121fa7e229c91eb65c5a8590e3a4e4abe38e8a785e0dde052b6d4bb7f7dfc56a6e6906ee4f5918b504d2f833f0bbfbe12a63a5c08cca0e3c0654895d82136eb1dd1d141cd58333fc95ded0bc25dd40b98d1d8041c48d4e393f205477950c39',
  
'p' => 'f4e358acca7bfb115c866480add864a0791d30672ea0cee08b91ae97ddaa4bebf5ebf02ba805f380da3b48b07ed50bf5afeff356ee6133ba247a8e93167bef2fd10eaa9b8d3603ed0edd8ed4ddb85adb21e0caf494787a7fd4b4eafde28037550e1c7a98172f1ab2c13b4ec418f3d8648eb2054ebcb0083c991420153bb6aac7',
  
'q' => 'f3ec2769298a61ceeff231f67d2c56cf191721e4abd86f4c6b7c76f5d5f2cd728352bc0f39158a6a43ce2479c8443f1f775f6425c69b36c9aeeb4e70d6958861785056808d5ac7e29ab11ac43a7a72b4c6a3e4138422956c8479ef84e6a541394a358c77420e0e87abb026b3f35f4ba83c23a2322feb5f0af6e15d6ac0c895a7',
  
'dmp1' => 'b01110fd52aba70c89787aa3e5d9d2276a4ca933565bf9c189b7594f08e95aa2b0f24c8026d2f88ae8dc7cdba0a4ee6f5b6a6a8b52e281fd5022e98529423beb2624a4572844f0b7acdb70c8ed0c920e41224ce96221e8f925665a19e59287b5d86a735e0c352abde09e12787cf43cddb79698a84e9345a8c3eaab5278d7519b',
  
'dmq1' => '18efcfa7a4a38d1446db8fd80f3bf533fef0aa7a62472239c1d35ba60e55604390c1689075d989e90b3d8be5176042c3c8c46bcca0dd4560a10d555b9bd475b8e13ff557f71b8ccbd1dcc14bc65eb6535ceb6c69c25c76c23d58e9efc054acb25aafd6c86a6c5d77e9497ceb70ba115605afeee90a951986596ef8c9ed239489',
  
'iqmp' => '6f2c333925b7d152bb91eda2770b7e605539e5e28a9c751d2a5f69a254fb72a89c2750954188ecdf73c7a715330cdbfdd8f6b692a48cfc49fdbe983f038a2f77de9bd567669231470370104da038756faf6c69df50dc7322694f107e3d17c5090720a9785337c6e0825bfb03b582d05ef983e2fb213b952a6a34319f833ae7a4',
]
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