mirror of
https://github.com/selfxyz/self.git
synced 2026-01-09 14:48:06 -05:00
update rsapss tests (#70)
This commit is contained in:
@@ -67,7 +67,10 @@ describe('VerifyRsapss Circuit Test', function () {
|
||||
algorithm.saltLength
|
||||
);
|
||||
|
||||
const invalidSignature = signature.map((byte: string) => String((parseInt(byte) + 1) % 256));
|
||||
const invalidSignature = [...signature];
|
||||
const randomIndex = Math.floor(Math.random() * signature.length);
|
||||
invalidSignature[randomIndex] = String((BigInt(signature[randomIndex]) + 1n).toString());
|
||||
|
||||
const circuit = await wasmTester(
|
||||
path.join(
|
||||
__dirname,
|
||||
@@ -95,7 +98,11 @@ describe('VerifyRsapss Circuit Test', function () {
|
||||
algorithm.saltLength
|
||||
);
|
||||
|
||||
const invalidMessage = message.map((byte: number) => String((byte + 1) % 256));
|
||||
// Flip one bit in the message
|
||||
const invalidMessage = [...message];
|
||||
const randomIndex = Math.floor(Math.random() * message.length);
|
||||
invalidMessage[randomIndex] = invalidMessage[randomIndex] === 0 ? 1 : 0;
|
||||
|
||||
const circuit = await wasmTester(
|
||||
path.join(
|
||||
__dirname,
|
||||
|
||||
@@ -174,8 +174,8 @@ export function genMockPassportData(
|
||||
dsc = mockCertificates.mock_dsc_sha256_rsapss_32_65537_3072;
|
||||
break;
|
||||
case 'rsapss_sha256_65537_4096':
|
||||
privateKeyPem = mockCertificates.mock_dsc_sha256_rsapss_32_65537_2048_key;
|
||||
dsc = mockCertificates.mock_dsc_sha256_rsapss_32_65537_2048;
|
||||
privateKeyPem = mockCertificates.mock_dsc_sha256_rsapss_32_65537_4096_key;
|
||||
dsc = mockCertificates.mock_dsc_sha256_rsapss_32_65537_4096;
|
||||
break;
|
||||
case 'ecdsa_sha256_brainpoolP384r1_384':
|
||||
privateKeyPem = mockCertificates.mock_dsc_sha256_ecdsa_brainpoolP384r1_key;
|
||||
|
||||
Reference in New Issue
Block a user