Skip to content

Commit

Permalink
test s >= n
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Jun 6, 2024
1 parent 219100b commit a96110f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/utils/cryptography/RSA.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ describe('RSA', function () {
});

describe('others tests', function () {
it('should fail if s >= n', async function () {
const data = ethers.toUtf8Bytes('hello world');
const sig =
'0x079bed733b48d69bdb03076cb17d9809072a5a765460bc72072d687dba492afe951d75b814f561f253ee5cc0f3d703b6eab5b5df635b03a5437c0a5c179309812f5b5c97650361c645bc99f806054de21eb187bc0a704ed38d3d4c2871a117c19b6da7e9a3d808481c46b22652d15b899ad3792da5419e50ee38759560002388';
const exp =
'0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001';
const mod =
'0xdf3edde009b96bc5b03b48bd73fe70a3ad20eaf624d0dc1ba121a45cc739893741b7cf82acf1c91573ec8266538997c6699760148de57e54983191eca0176f518e547b85fe0bb7d9e150df19eee734cf5338219c7f8f7b13b39f5384179f62c135e544cb70be7505751f34568e06981095aeec4f3a887639718a3e11d48c240d';
const sig2 = ethers.toBeHex(ethers.toBigInt(sig) + ethers.toBigInt(mod));
expect(await this.mock.$pkcs1Sha256(data, sig2, exp, mod)).to.be.false;
});

it('openssl', async function () {
const data = ethers.toUtf8Bytes('hello world');
const sig =
Expand Down

0 comments on commit a96110f

Please # to comment.