-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsa.php
24 lines (18 loc) · 2.57 KB
/
rsa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$key="-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvPuL3jWE8WnzAS0IszYU
RfTK1fLybBK42QIpOMWW5dw9B4BxlZkhZtDIx6uqw7MeMFKdD1mxDwTo4yszlwBc
DqUmjvL965ZWqjtAhjkvS9atNnFGYz46HIHZYDRVHrCRfyOOpRD91A/xQTVPAIsl
qAxWprLW2YwIeR5toy/3Uzv9WceU+xFVi05Gl6F8//QI7x2UoZkS9UXtR/7+zWzE
JNu4Gkx0YbzAXPQbo2IZVew9W2XaP3kKczK8IFFmvpj6ThzH0FDxrm9t99Ig0by4
zpqt2v04dhJirhSJzSKVIhL4Kl1HD5dJllITlVHLPBT0NXUw/QImDuKvABjn4ZhP
rwIDAQAB
-----END PUBLIC KEY-----";
echo print_r(openssl_pkey_get_details(openssl_pkey_get_public($key)), true);
echo OPENSSL_ALGO_SHA256 . "!SIG DATA: " . hex2bin("27EE1D41543B77E63D3CC98F28CD633ECDD8D4C8F2C6FA8AF6E3F3FEA787DB520269C306CF82AD9E98D1266BBB87D4428611B4F9343FBD1513E634A82165AAC1DDE17A2B01AB8A50B8595AAD07FC8A23DA643F8F1EBAC82A74936177BA41F49D24B065471E013CC3DEFA8CAE69F80CC154C5FAF97CCA04B6ED6160AA26D0F051AA387FE71E050D83EEE658F6CC879C7F0875A875F3284E4D7B435E1428A6DC1C4FA31396F1CC5483B8D484AF4607CEF8B17A59BDDA7069B8A9724BC143F928846D7FA6A1D431D8B23BD3407A152ECFFD122FBE32A91415CFD7DB38C757A2C590F5CFACCB420A131506DB94BF118F5F5EAA6B975D68322DC881CC0F258218D69A") . "!";
echo "<br /><br />(KEY: " . base64_encode( hex2bin("30820122300D06092A864886F70D01010105000382010F003082010A0282010100BCFB8BDE3584F169F3012D08B3361445F4CAD5F2F26C12B8D9022938C596E5DC3D07807195992166D0C8C7ABAAC3B31E30529D0F59B10F04E8E32B3397005C0EA5268EF2FDEB9656AA3B4086392F4BD6AD367146633E3A1C81D96034551EB0917F238EA510FDD40FF141354F008B25A80C56A6B2D6D98C08791E6DA32FF7533BFD59C794FB11558B4E4697A17CFFF408EF1D94A19912F545ED47FEFECD6CC424DBB81A4C7461BCC05CF41BA3621955EC3D5B65DA3F790A7332BC205166BE98FA4E1CC7D050F1AE6F6DF7D220D1BCB8CE9AADDAFD38761262AE1489CD22952212F82A5D470F97499652139551CB3C14F4357530FD02260EE2AF0018E7E1984FAF0203010001")) . ")";
echo "<br /><br />*HASH: " . hex2bin("1209d13d62fd79f5e00e4d5ce672110d33640439cdaf3ffa220e4616133b1069") . "*";
$det = openssl_pkey_get_details(openssl_pkey_get_public($key));
echo "<br /><br />-" . openssl_verify ( hex2bin("27EE1D41543B77E63D3CC98F28CD633ECDD8D4C8F2C6FA8AF6E3F3FEA787DB520269C306CF82AD9E98D1266BBB87D4428611B4F9343FBD1513E634A82165AAC1DDE17A2B01AB8A50B8595AAD07FC8A23DA643F8F1EBAC82A74936177BA41F49D24B065471E013CC3DEFA8CAE69F80CC154C5FAF97CCA04B6ED6160AA26D0F051AA387FE71E050D83EEE658F6CC879C7F0875A875F3284E4D7B435E1428A6DC1C4FA31396F1CC5483B8D484AF4607CEF8B17A59BDDA7069B8A9724BC143F928846D7FA6A1D431D8B23BD3407A152ECFFD122FBE32A91415CFD7DB38C757A2C590F5CFACCB420A131506DB94BF118F5F5EAA6B975D68322DC881CC0F258218D69A")
, hex2bin("1209d13d62fd79f5e00e4d5ce672110d33640439cdaf3ffa220e4616133b1069")
, $key, OPENSSL_ALGO_SHA256) . "-";