mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
fix few details and typos
This commit is contained in:
@@ -83,4 +83,5 @@ template Register_ecdsaWithSHA1Encryption(n, k, max_datahashes_bytes, nLevels, s
|
||||
signal output commitment <== poseidon_hasher.out;
|
||||
}
|
||||
|
||||
// We hardcode 7 here for ecdsa_with_SHA1
|
||||
component main { public [ attestation_id ] } = Register_ecdsaWithSHA1Encryption(43, 6, 320, 16, 7);
|
||||
|
||||
@@ -83,4 +83,5 @@ template Register_ecdsaWithSHA256Encryption(n, k, max_datahashes_bytes, nLevels,
|
||||
signal output commitment <== poseidon_hasher.out;
|
||||
}
|
||||
|
||||
// We hardcode 8 here for ecdsa_with_SHA256
|
||||
component main { public [ attestation_id ] } = Register_ecdsaWithSHA256Encryption(43, 6, 320, 16, 8);
|
||||
|
||||
@@ -62,5 +62,5 @@ template Register_sha1WithRSAEncryption_65537(n, k, max_datahashes_bytes, nLevel
|
||||
|
||||
}
|
||||
|
||||
// We hardcode 1 here for sha1WithRSAEncryption_65537
|
||||
// We hardcode 3 here for sha1WithRSAEncryption_65537
|
||||
component main { public [ attestation_id ] } = Register_sha1WithRSAEncryption_65537(121, 17, 320, 16, 3);
|
||||
|
||||
@@ -62,5 +62,5 @@ template register_sha256WithRSASSAPSS_65537(n, k, max_datahashes_bytes, nLevels,
|
||||
|
||||
}
|
||||
|
||||
// We hardcode 1 here for sha256WithRSAEncryption_65537
|
||||
// We hardcode 4 here for sha256WithRSASSAPSS_65537
|
||||
component main { public [ attestation_id ] } = register_sha256WithRSASSAPSS_65537(64, 32, 320, 16, 4);
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
pragma circom 2.1.5;
|
||||
|
||||
include "circomlib/circuits/poseidon.circom";
|
||||
include "@zk-email/circuits/utils/bytes.circom";
|
||||
include "./verifier/passport_verifier_sha256WithRSASSAPSS_65537.circom";
|
||||
include "../utils/chunk_data.circom";
|
||||
include "../utils/compute_pubkey_leaf.circom";
|
||||
include "binary-merkle-root.circom";
|
||||
|
||||
template register_sha256WithRSASSAPSS_65537(n, k, max_datahashes_bytes, nLevels, signatureAlgorithm) {
|
||||
signal input secret;
|
||||
|
||||
signal input mrz[93];
|
||||
signal input dg1_hash_offset;
|
||||
signal input econtent[max_datahashes_bytes];
|
||||
signal input datahashes_padded_length;
|
||||
signal input signed_attributes[104];
|
||||
signal input signature[k];
|
||||
|
||||
signal input pubkey[k];
|
||||
signal input merkle_root;
|
||||
signal input path[nLevels];
|
||||
signal input siblings[nLevels];
|
||||
|
||||
signal input attestation_id;
|
||||
|
||||
// Verify inclusion of the pubkey in the pubkey tree
|
||||
signal leaf <== ComputePubkeyLeaf(n, k, signatureAlgorithm)(pubkey);
|
||||
signal computed_merkle_root <== BinaryMerkleRoot(nLevels)(leaf, nLevels, path, siblings);
|
||||
merkle_root === computed_merkle_root;
|
||||
|
||||
// Verify passport validity
|
||||
component PV = PassportVerifier_sha256WithRSASSAPSS_65537(n, k, max_datahashes_bytes);
|
||||
PV.mrz <== mrz;
|
||||
PV.dg1_hash_offset <== dg1_hash_offset;
|
||||
PV.dataHashes <== econtent;
|
||||
PV.datahashes_padded_length <== datahashes_padded_length;
|
||||
PV.eContentBytes <== signed_attributes;
|
||||
PV.pubkey <== pubkey;
|
||||
PV.signature <== signature;
|
||||
|
||||
// Generate the commitment
|
||||
component poseidon_hasher = Poseidon(6);
|
||||
poseidon_hasher.inputs[0] <== secret;
|
||||
poseidon_hasher.inputs[1] <== attestation_id;
|
||||
poseidon_hasher.inputs[2] <== leaf;
|
||||
|
||||
signal mrz_packed[3] <== PackBytes(93)(mrz);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
poseidon_hasher.inputs[i + 3] <== mrz_packed[i];
|
||||
}
|
||||
signal output commitment <== poseidon_hasher.out;
|
||||
|
||||
// Generate the nullifier
|
||||
var chunk_size = 11; // Since ceil(32 / 3) in integer division is 11
|
||||
signal chunked_signature[chunk_size] <== ChunkData(n, k, chunk_size)(signature);
|
||||
signal output nullifier <== Poseidon(chunk_size)(chunked_signature);
|
||||
}
|
||||
|
||||
// We hardcode 1 here for sha256WithRSAEncryption_65537
|
||||
component main { public [ merkle_root, attestation_id ] } = register_sha256WithRSASSAPSS_65537(121, 17, 320, 16, 4);
|
||||
@@ -27,7 +27,7 @@ describe('Register - SHA1 RSA', function () {
|
||||
'./node_modules/@zk-kit/binary-merkle-root.circom/src',
|
||||
'./node_modules/circomlib/circuits',
|
||||
'./node_modules/dmpierre/sha1-circom/circuits',
|
||||
'./node_modules/@zk-email/circuits ',
|
||||
'./node_modules/@zk-email/circuits',
|
||||
],
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user