显示下拉菜单

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-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2/5TgeIbkOg82OAVRb1b
bQQHO9Dw2pMHKouPSK84JAg2eF2dP1+t3HIVwpoN8nF+onvVmmgsJnx6zXvJsh6l
he1xrPFZFuzOAw1qvnGAdYj23hrv5NyaOlxOWuvv5O02BQ6R0WKS08JiJFCNDde2
3YddrhODR8+za495pEz9DkSTgRg4pPFHt0/j+rJHAI3jfEnyaVyzPQ8GZiqxM/4E
7s8mCEpCO3K/5n7eQJOeCmAgs5gn9QLE3h6vpcrTXbc+rjq/sIJeftydNtsKW8X9
+TgZLarIOR3HPiBnBEJYS/sl4f80ET6eX3C4Sy0EnhjPaQvlBYf1pglH99wS/6U3
mwIDAQAB
-----END PUBLIC KEY-----
'
,
  
'rsa' => [
    
'n' => 'S<E[m;ړ*H8$6x]?_rš q~{՚h,&|z{ɲqY jquܚ:\\NZ6bb$P ׶݇]GϳkyLD8GOG' "\0" '|Ii\\=f*3&JB;r~@
` \']>:^~ܝ6
[8-9> gBXK%4>_pK-i     G7'
,
    
'e' => '' "\0" '',
    
'd' => 'Rjp3 tAxn     Fͳ3"Fpc#NFeukx;HZ\\v>kާTLJ+A.y+FqTB} 5
.b1|7p9T`q(]\'fr#؜kNnH<ZG.p\'ϯ_Yl@vK:Ysv~ǯZr/*Z:!g2` pXtE%i eh3:PY(D'
,
    
'p' => '}μ=;R+x.<g0x+~I4Vlw<Oac\\9ԁt%*g j.W^bq:;43/[nо%Q@{ZFAt_Q    C',
    
'q' => 'nJz}5>d rjtk?4&Ww@L 7CGZQD4*^ݲb_=~mQXsMnºF"LJƋ!8h',
    
'dmp1' => '>?ݙ{weɰJ\\7~Fl    I,>*+.<?GY}G\\DJj,%gaݺUzJ0A׵C|P`K2SBWkbW7',
    
'dmq1' => 'S!ܶ^6 :+Diܟv e:Wvg?4t!M +?jN_*C_?#ϮkYUL쀜|H MiBCX%AӵL}a8ر',
    
'iqmp' => '@Lb\'Mnոw;uS3TA / H7ָgCH~p    ܰ50@ 9Wײ{`-7Z :kTG)%}ĜxdqOa!',
  ],
  
'type' => 0,
]
$hex = [
  
'n' => 'dbfe5381e21b90e83cd8e01545bd5b6d04073bd0f0da93072a8b8f48af38240836785d9d3f5faddc7215c29a0df2717ea27bd59a682c267c7acd7bc9b21ea585ed71acf15916ecce030d6abe71807588f6de1aefe4dc9a3a5c4e5aebefe4ed36050e91d16292d3c26224508d0dd7b6dd875dae138347cfb36b8f79a44cfd0e4493811838a4f147b74fe3fab247008de37c49f2695cb33d0f06662ab133fe04eecf26084a423b72bfe67ede40939e0a6020b39827f502c4de1eafa5cad35db73eae3abfb0825e7edc9d36db0a5bc5fdf938192daac8391dc73e20670442584bfb25e1ff34113e9e5f70b84b2d049e18cf690be50587f5a60947f7dc12ffa5379b',
  
'e' => '010001',
  
'd' => '8b1bc1f0526abdf1ac70331a20744178a8e06e198c039a8f207f09469bcdb33322467063bbac23c34ebca5c646657510ef6bc0c117783b89e119485a5cf076183ef1efbad96bdea7d2544c984a2b41a72efb792b129bd0467111f6fa54427d20f887a2fb350ac52e98628031017cd31c37b9ac16989ff31d70395460e971e6ef97285d27a866b77201cdd523aff0aad89c6b4e6e99f5bf489a1aada69f8aee993cfc16ff5a47ea2ec5701cfab027cfafbf5f59a36c4076c64b3a155973e976dd7ea2aac7af5a72fc85c0138c2f1f2a5acb3ab1c021c002d767328560a3f4a20b7058d87445a3b71d25692065688b33f93ad4c0e350598c06d52813df44898991',
  
'p' => 'ff7df7aba6cebc17c23d143b522b782efe3ce3a91dae6730782b1b91877e49181c3402adb9566c773c4f6163c25c9afc39d48174c525fecf062afeb38767207fc9e4d8166adc2ec9575e62713acdbe173406af33a7d9cf2ff5d7d301ee5b8211b66e9211fcd0be255103407b7f5aa2e446dafb41745f9b9c51059ab51309f343',
  
'q' => 'dc6e4aafe2bf7a7d1b359990817f3e81640cf41a1b726a741d986ba5d73fed08ee3426d6577796891c40c1e0db4c0c88fdad91f2a2e4be0f8737439e475af951d1d544d934c22ac5115eddb2625fde0514ebdc3d7e6deb51101e587383fc0f4d83901c05bb1a6eac83c7c2ba9ba402d60203469cd922c78711c68b2138d668c9',
  
'dmp1' => 'f33e3fdd99db7bb2770865c9b08a984acd5cb5371e7e1bda469e6c09dae0fdc049a1aee72cec3e2a2b2e3c3f991d47a5597d9b9ecbd047cf5c44f4e781c34a6abf91f3b52c19e32567dc018761ffddba039b5594ad7aae4a301a41d7b5d2437c8f9ea7cd1e50b2a79e80a514af0460cf4b32534257046b87a08fe06202f55737',
  
'dmq1' => 'c15321c1dcb65eb13699edd2e5203a2bb519ff449e69dc9f760d65ec0f3a8ba35776f9d0e6e985673f16347407214da5200788872b023f06d36a4ead949b5f2ab943b89c5f3f23cfae8a6b19b659aa18fede554cc18399ec809c7caae348c00b15a5e04dce6942439f58259b1041ea12d3b517cb1c4cfa7da5c361e68338d8b1',
  
'iqmp' => 'a1400f4c6227059c9c4d6eb0d5b87705bba43b75c8f9533385548e4120b32fb8c40d17faf3af054837a2d6b81667b71c10e91ef90403b2aa43d248a17e12cac8c1b7c6e1d57009e5dcb035a10530400dcf39908c57d7b27b60f32d3790c0045acfefac203aca06a6f26b5447291d25bb070f8d7da803c49c057864714f61c421',
]
示例
#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