diff --git a/lib/bbs/blind/core.js b/lib/bbs/blind/core.js index 64c6a11..801f111 100644 --- a/lib/bbs/blind/core.js +++ b/lib/bbs/blind/core.js @@ -48,9 +48,9 @@ export function CoreBlindSign({ commitment_with_proof, generators, api_id, ciphersuite }); const {Q_1} = generators; - // Identity_G1 == ciphersuite.E1.ONE + // Identity_G1 == ciphersuite.Identity_E1 const Q_2 = commitment_with_proof.length === 0 ? - ciphersuite.E1.ONE : generators[1]; + ciphersuite.Identity_E1 : generators[1]; const H = generators.slice(M + 1, M + L + 2); /* Algorithm: @@ -100,7 +100,7 @@ export function CoreBlindSign({ const {Fr} = ciphersuite; const A = B.multiply(Fr.inv(Fr.add(SK, e))); // if A == Identity_G1 throw invalid signature error - if(ciphersuite.E1.eql(A, ciphersuite.E1.ONE)) { + if(A.equals(ciphersuite.Identity_E1)) { throw new Error('Invalid signature.'); } return signature_to_octets({signature: [A, e], ciphersuite}); diff --git a/lib/bbs/blind/util.js b/lib/bbs/blind/util.js index e84a0f1..ba26ea1 100644 --- a/lib/bbs/blind/util.js +++ b/lib/bbs/blind/util.js @@ -156,7 +156,7 @@ export function octets_to_commitment_with_proof({ const C_octets = commitment_with_proof_octets.subarray( 0, octet_point_length); const C = ciphersuite.octets_to_point_E1(C_octets); - if(ciphersuite.E1.eql(C, ciphersuite.E1.ONE)) { + if(C.equals(ciphersuite.Identity_E1)) { throw new Error('Invalid point in commitment.'); } diff --git a/lib/bbs/core.js b/lib/bbs/core.js index e194bfe..c12314f 100644 --- a/lib/bbs/core.js +++ b/lib/bbs/core.js @@ -217,7 +217,7 @@ export function CoreSign({ const {Fr} = ciphersuite; const A = B.multiply(Fr.inv(Fr.add(SK, e))); // if A == Identity_G1 throw invalid signature error - if(ciphersuite.E1.eql(A, ciphersuite.E1.ONE)) { + if(A.equals(ciphersuite.Identity_E1)) { throw new Error('Invalid signature.'); } return signature_to_octets({signature: [A, e], ciphersuite}); diff --git a/lib/bbs/pseudonym/interface.js b/lib/bbs/pseudonym/interface.js index f422cb2..4e96452 100644 --- a/lib/bbs/pseudonym/interface.js +++ b/lib/bbs/pseudonym/interface.js @@ -29,9 +29,9 @@ export function CalculatePseudonym({verifier_id, pid, ciphersuite} = {}) { */ const OP = ciphersuite.hash_to_curve_g1(verifier_id, api_id); - // Identity_G1 == ciphersuite.E1.ONE - const {BP1, P1, E1} = ciphersuite; - if(E1.eql(OP, E1.ONE) || E1.eql(OP, BP1) || E1.eql(OP, P1)) { + // Identity_G1 == ciphersuite.Identity_E1 + const {BP1, Identity_E1, P1} = ciphersuite; + if(OP.equals(Identity_E1) || OP.equals(BP1) || OP.equals(OP, P1)) { throw new Error('Invalid verifier ID.'); } const messages = [pid]; diff --git a/lib/bbs/util.js b/lib/bbs/util.js index 4b35969..c539e5a 100644 --- a/lib/bbs/util.js +++ b/lib/bbs/util.js @@ -288,7 +288,7 @@ export function octets_to_proof({proof_octets, ciphersuite} = {}) { for(let i = 0; i <= 2; ++i) { A[i] = ciphersuite.octets_to_point_E1( proof_octets.subarray(index, index + octet_point_length)); - if(ciphersuite.E1.eql(A, ciphersuite.E1.ONE)) { + if(A[i].equals(ciphersuite.Identity_E1)) { throw new Error('Invalid point in proof.'); } index += octet_point_length; @@ -339,7 +339,7 @@ export function octets_to_pubkey({PK, ciphersuite} = {}) { // conversion handles checking that point is on the curve const W = ciphersuite.octets_to_point_E2(PK); // if W == Identity_E2 throw invalid public key error - if(ciphersuite.E2.eql(W, ciphersuite.E2.ONE)) { + if(W.equals(ciphersuite.Identity_E2)) { throw new Error('Invalid public key.'); } return W; @@ -374,7 +374,7 @@ export function octets_to_signature({signature_octets, ciphersuite} = {}) { // conversion handles checking that point is on the curve const A = ciphersuite.octets_to_point_E1(A_octets); // if A == Identity_G1 throw invalid signature error - if(ciphersuite.E1.eql(A, ciphersuite.E1.ONE)) { + if(A.equals(ciphersuite.Identity_E1)) { throw new Error('Invalid signature.'); } const e = os2ip(signature_octets.subarray(octet_point_length));