File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,18 @@ describe('RSA', function () {
4141 } ) ;
4242
4343 describe ( 'others tests' , function ( ) {
44+ it ( 'should fail if s >= n' , async function ( ) {
45+ const data = ethers . toUtf8Bytes ( 'hello world' ) ;
46+ const sig =
47+ '0x079bed733b48d69bdb03076cb17d9809072a5a765460bc72072d687dba492afe951d75b814f561f253ee5cc0f3d703b6eab5b5df635b03a5437c0a5c179309812f5b5c97650361c645bc99f806054de21eb187bc0a704ed38d3d4c2871a117c19b6da7e9a3d808481c46b22652d15b899ad3792da5419e50ee38759560002388' ;
48+ const exp =
49+ '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001' ;
50+ const mod =
51+ '0xdf3edde009b96bc5b03b48bd73fe70a3ad20eaf624d0dc1ba121a45cc739893741b7cf82acf1c91573ec8266538997c6699760148de57e54983191eca0176f518e547b85fe0bb7d9e150df19eee734cf5338219c7f8f7b13b39f5384179f62c135e544cb70be7505751f34568e06981095aeec4f3a887639718a3e11d48c240d' ;
52+ const sig2 = ethers . toBeHex ( ethers . toBigInt ( sig ) + ethers . toBigInt ( mod ) ) ;
53+ expect ( await this . mock . $pkcs1Sha256 ( data , sig2 , exp , mod ) ) . to . be . false ;
54+ } ) ;
55+
4456 it ( 'openssl' , async function ( ) {
4557 const data = ethers . toUtf8Bytes ( 'hello world' ) ;
4658 const sig =
You can’t perform that action at this time.
0 commit comments