显示下拉菜单

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"]);
}
?>
结果
$resource = 'OpenSSL key ressource'
$array = [
  
'bits' => 2048,
  
'key' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1YG+Ao6QKFuVPPDQ1d2N
l8rtqmOIXl4sklE6PNxqH7B38BXi8VVG4gJrKBOIt7CTCWDaycEOqH2BRbkzy0hr
H0PVe29Y7TOTvUss39fzLlwL0MmzQ5U2d1RYdWfL+tUlDETtrwGWfTMjgUp/tAlP
OffpJH/TdZLueCr+xtdVtnNSGv0hDqxe+bGebZxRsIdjKPvinBjjKDE50f1mDfLR
1L3Qxx3pNwVGAmH89GomzT5MqKka1YMWc17Ddegj98kCP1NUmti8KHVY1e+Xni/i
aLNGbyLSCYuDlpLP+1EMZ3N475Vrdl6Ph59hwufQf1XsguKyLxJdwmE8y4Fe0fqV
NQIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'Ձ([<ݍc^^,Q:<jwUFk(    `}E3HkC{oX3K,.\\ ɳC6wTXug% D}3#J    O9$ux*UsR!^mQc((19f Խ7Faj&>LՃs^u#?STؼ(uX/hFo"    Q gsxkv^aU/]a<ˁ^5',
    
'e' => '' "\0" '',
    
'd' => 'WTk
UF)Ao(|ڤ(o&L9x>RMM<rEe :&ob: x}qTτXC ˇ@yyC`JNxh˷n$68Ǵ     U տQ"aͼ,|#a=iHa6ӭFeӎ*i:]UgSB pa&VG@b8pQf]# Es {9'
,
    
'p' => 'nMѐT==wR!ٶ7I%.1NTן]1#qL2    ӮQ!fHQ#f~GE[^' "\0" 'AVW DNCD \'',
    
'q' => '' "\0" 'Q} K    l?z    a `l؃z2uKzV> :Îh;+LQy@VpORpY    aZqf^n$/    fΖ]νSViJJfգ2',
    
'dmp1' => '" ^+-MSnbe3VZ&    G40SkZY1hLӛFkn6%~CBa*uDžᨔi*s`HΥ e֛_%wґ 5sߢ<9',
    
'dmq1' => 'UekoRA=oy^ajOa4xGF n\\F cu HLJ^j&=Fy  Ώ}$' "\0" 'A;2 =&/`kFW    v׳Y&',
    
'iqmp' => '8' "\0" '!2nb29XpC? P*,4L]Q{(r  +_T-5HwlKi@!pCDKԬʌ' "\0" '5%ȗhO',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'd581be028e90285b953cf0d0d5dd8d97caedaa63885e5e2c92513a3cdc6a1fb077f015e2f15546e2026b281388b7b0930960dac9c10ea87d8145b933cb486b1f43d57b6f58ed3393bd4b2cdfd7f32e5c0bd0c9b34395367754587567cbfad5250c44edaf01967d3323814a7fb4094f39f7e9247fd37592ee782afec6d755b673521afd210eac5ef9b19e6d9c51b0876328fbe29c18e3283139d1fd660df2d1d4bdd0c71de93705460261fcf46a26cd3e4ca8a91ad58316735ec375e823f7c9023f53549ad8bc287558d5ef979e2fe268b3466f22d2098b839692cffb510c677378ef956b765e8f879f61c2e7d07f55ec82e2b22f125dc2613ccb815ed1fa9535',
  
'e' => '010001',
  
'd' => '57dceeaeeab0548b6bdd0a5546cdc829416f910128eb7ce1e6ccdaa495286f2616158d4c3978989505ddc73e52b3154d4d3cb88cf28fefb2c6724507158f15d665fa02b40dea7fa13af326e26f623a1fd314f70c78b17d1a9a7154cf845813430dcb87eccf4079018488fe7993438981178eb060924afe4e78d168cbb76e24888c36b4a338f513c7b409fff1930bd6ff9a0c80f0e69655f9d90ccf11e1d5bfc4dce351229792ae61bbcdbc2cfff07c23f2613da9aa8769486136f1f7f5edd3adaf469965a0d38e0687bbb618e32a69178093923a9b5d9d8f556753f9420db5077061d7265686a34791406238705166a196cb155db3c9230b0245a796730b7b39',
  
'p' => 'ef18b4ac86f76e4de8d19010ef543d3d9decc21677db5221d9b6374925cf15fefd1c84022e3108e887124e54d79fa95dc1f931a423714cada4328409b9d3ae0395519ea52166488def519d8e82ed23efdc660fedfb7efe47e417e582d945d5e55b1e160ee5ac168deb5e00d341560257ee0c444e43a0440c11988327f0bdd5d7',
  
'q' => 'e499e68e1b00519d7db89c0db34b8b9709f76cf03f7a9209d7610ba9f7fea9606ccfd883827a0e0432aa10beb483a5754bbdf37a56b53e20ad3a1001c38ed668f73b2b4c51bd939179409b1e5670d0de4ff252bb70591209615ae07101c2f8665e946e242f8709f466ce96bb5df4cebd539ef9ab56694a94ad4a66d5a332b3d3',
  
'dmp1' => 'aa22205e2be3e11f9b2d93a0194d0e0ecc536e80626533fa565aecd8260947939c34305304df6b815aabd20559318968e7e0144cc1d39b466bf26e36257ed4f243cc42612a7507e7c78581e1a89469e0022ab5e717f073ac604808cea520a6658002d69b5f1ea725f177808ad2910b35da73ec1eeccc1bdfa29dada63c0e391d',
  
'dmq1' => 'a55565b96b6fec9752413da46f03795ef0d76193d4e56a4ff1d4ff619bba347847da7f46860c8eac9c94016e5c12468db20d1cd66375cc0c481d114ca54a5e6a263d461079a1f9e3a1e5870b070bab14ce8f7d249199ea009cc7e441f73b32fa9ef70d3de09df3262f60c505986ba146aefef0a5e9e6570976d7b3ce59ad26ff',
  
'iqmp' => '3807001ea521bd9f14326eeb629a32c6d1399558701a433fb20b1f140596502afccd2ca0b9344cbf5d517beba828fd72c9100b0e208480bb2bc3fee05fbbbbc254ed2d35b5c18e1a4805baafa8f9776c4bacbf69a807d2f4a1071ef1408f21e070da43ae440701b5d5cd4bd4acca8c009b8735f9ca25c897681a11dff003ef4f',
]
示例
#1 openssl_pkey_new  ()
#2 openssl_pkey_new  (["digest_alg" => "sha512""private_key_bits" => 4096"private_key_type" => OPENSSL_KEYTYPE_RSA])
另请参阅
array_map, openssl_pkey_get_details