fix: gen inputs for ecdsa with sha256 and sha512

This commit is contained in:
0xvikasrushi
2024-07-30 18:36:15 +00:00
parent 1600876b92
commit 73d9fb5bf8
2 changed files with 259 additions and 1780 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -47,6 +47,7 @@ export function generateCircuitInputsRegister(
'sha1WithRSAEncryption',
'sha256WithRSASSAPSS',
'ecdsa-with-SHA1',
'ecdsa-with-SHA256',
].includes(signatureAlgorithm)
) {
console.error(`${signatureAlgorithm} has not been implemented.`);
@@ -101,7 +102,12 @@ export function generateCircuitInputsRegister(
let dsc_modulus: any;
let signature: any;
if (signatureAlgorithm === 'ecdsa-with-SHA1') {
if (
signatureAlgorithm === 'ecdsa-with-SHA1' ||
signatureAlgorithm === 'ecdsa-with-SHA256' ||
signatureAlgorithm === 'ecdsa-with-SHA512' ||
signatureAlgorithm === 'ecdsa-with-SHA384'
) {
const curve_params = pubKey.publicKeyQ.replace(/[()]/g, '').split(',');
dsc_modulus = [curve_params[0], curve_params[1]]; // ! TODO REFACTOR SPLIT HERE WHAT IF WORKS
signature = passportData.encryptedDigest;