uncomment tests, clean code and remove dummy from circuit inputs

This commit is contained in:
turnoffthiscomputer
2024-12-16 13:41:45 +01:00
parent b58d2f7c96
commit 065374afd0
4 changed files with 17 additions and 26 deletions

View File

@@ -47,7 +47,7 @@ template OPENPASSPORT_PROVE(signatureAlgorithm, n, k, MAX_ECONTENT_PADDED_LEN, M
signal input secret;
signal input dsc_secret;
signal input dummy;
signal dummy <== 0;
signal attestation_id <== 1;

View File

@@ -14,16 +14,16 @@ import namejson from '../../common/ofacdata/outputs/nameSMT.json';
import { log } from 'console';
const sigAlgs = [
// { sigAlg: 'rsa', hashFunction: 'sha1', domainParameter: '65537', keyLength: '2048' },
// { sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '65537', keyLength: '2048' },
// { sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '2048' },
// { sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '3072' },
// { sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '4096' },
// { sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '3', keyLength: '4096' },
// { sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '3', keyLength: '3072' },
// { sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '3', keyLength: '2048' },
// { sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '65537', keyLength: '3072' },
// { sigAlg: 'ecdsa', hashFunction: 'sha256', domainParameter: 'secp256r1', keyLength: '256' },
{ sigAlg: 'rsa', hashFunction: 'sha1', domainParameter: '65537', keyLength: '2048' },
{ sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '65537', keyLength: '2048' },
{ sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '2048' },
{ sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '3072' },
{ sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '65537', keyLength: '4096' },
{ sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '3', keyLength: '4096' },
{ sigAlg: 'rsapss', hashFunction: 'sha256', domainParameter: '3', keyLength: '3072' },
{ sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '3', keyLength: '2048' },
{ sigAlg: 'rsa', hashFunction: 'sha256', domainParameter: '65537', keyLength: '3072' },
{ sigAlg: 'ecdsa', hashFunction: 'sha256', domainParameter: 'secp256r1', keyLength: '256' },
{ sigAlg: 'ecdsa', hashFunction: 'sha1', domainParameter: 'secp256r1', keyLength: '256' },
];
@@ -73,13 +73,6 @@ sigAlgs.forEach(({ sigAlg, hashFunction, domainParameter, keyLength }) => {
__dirname,
`../circuits/prove/instances/${getCircuitName('prove', sigAlg, hashFunction, domainParameter, keyLength)}.circom`
),
{
include: [
// 'node_modules',
// './node_modules/@zk-kit/binary-merkle-root.circom/src',
// './node_modules/circomlib/circuits',
],
}
);
});
@@ -104,8 +97,8 @@ sigAlgs.forEach(({ sigAlg, hashFunction, domainParameter, keyLength }) => {
.blinded_dsc_commitment;
console.log('\x1b[34m%s\x1b[0m', 'blinded_dsc_commitment', blinded_dsc_commitment);
// const ofac_result = (await circuit.getOutput(w, ['ofac_result'])).ofac_result;
// console.log('\x1b[34m%s\x1b[0m', 'ofac_result', ofac_result);`
const ofac_result = (await circuit.getOutput(w, ['ofac_result'])).ofac_result;
console.log('\x1b[34m%s\x1b[0m', 'ofac_result', ofac_result);
expect(blinded_dsc_commitment).to.be.not.null;
expect(nullifier).to.be.not.null;

View File

@@ -156,17 +156,16 @@ export function genMockPassportData(
sampleDataHashes = sampleDataHashes_large;
privateKeyPem = mock_dsc_key_sha256_rsapss_65537_3072;
dsc = mock_dsc_sha256_rsapss_65537_3072;
break;
break;
case 'rsapss_sha256_65537_4096':
sampleDataHashes = sampleDataHashes_large;
privateKeyPem = mock_dsc_key_rsapss_65537_4096;
dsc = mock_dsc_sha256_rsapss_65537_4096;
break;
break;
}
const { hashFunction, hashLen } = parseCertificate(dsc);
console.log(mrz);
const mrzHash = hash(hashFunction, formatMrz(mrz));
const concatenatedDataHashes = formatAndConcatenateDataHashes(
[[1, mrzHash], ...sampleDataHashes],

View File

@@ -188,7 +188,7 @@ export function generateCircuitInputsProve(
let pubKey: any;
let signature: any;
const { n, k } = getNAndK(`${signatureAlgorithm}_${hashFunction}_${curve || exponent}_${bits}`);
const { n, k } = getNAndK(`${signatureAlgorithm}_${hashFunction}_${curve || exponent}_${bits}` as any);
if (signatureAlgorithm === 'ecdsa') {
const { r, s } = extractRSFromSignature(encryptedDigest);
@@ -272,8 +272,7 @@ export function generateCircuitInputsProve(
smt_leaf_value: formatInput(smt_leaf_value),
smt_siblings: formatInput(smt_siblings),
selector_ofac: formatInput(selector_ofac),
forbidden_countries_list: formatInput(formatCountriesList(forbidden_countries_list)),
dummy: dummy,
forbidden_countries_list: formatInput(formatCountriesList(forbidden_countries_list))
};
}