@@ -120,24 +120,18 @@ public IdemixSignature(IdemixCredential c, BIG sk, IdemixPseudonym pseudonym, Id
120120 rAttrs [i ] = IdemixUtils .randModOrder (rng );
121121 }
122122
123- // Compute revocation contribution
124- RevocationProver prover = RevocationProver . getProver (revocationAlgorithm );
123+ // Compute non-revoked proof
124+ NonRevocationProver prover = NonRevocationProver . getNonRevocationProver (revocationAlgorithm );
125125 int hiddenRHIndex = Ints .indexOf (hiddenIndices , rhIndex );
126126 if (hiddenRHIndex < 0 ) {
127127 // rhIndex is not present, set to last index position
128128 hiddenRHIndex = hiddenIndices .length ;
129129 }
130- byte [] revocationFSContribution = prover .getFSContribution (
131- BIG .fromBytes (c .getAttrs ()[rhIndex ]),
132- rAttrs [hiddenRHIndex ],
133- cri
134- );
135- if (revocationFSContribution == null ) {
130+ byte [] nonRevokedProofHashData = prover .getFSContribution (BIG .fromBytes (c .getAttrs ()[rhIndex ]), rAttrs [hiddenRHIndex ], cri );
131+ if (nonRevokedProofHashData == null ) {
136132 throw new RuntimeException ("Failed to compute non-revoked proof" );
137133 }
138134
139- // System.out.println(Arrays.toString(revocationFSContribution));
140-
141135 ECP t1 = aPrime .mul2 (re , ipk .getHRand (), rR2 );
142136 ECP t2 = PAIR .G1mul (ipk .getHRand (), rSPrime );
143137 t2 .add (bPrime .mul2 (rR3 , ipk .getHsk (), rsk ));
@@ -162,7 +156,6 @@ public IdemixSignature(IdemixCredential c, BIG sk, IdemixPseudonym pseudonym, Id
162156 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (aBar ));
163157 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (bPrime ));
164158 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (pseudonym .getNym ()));
165- proofData = IdemixUtils .append (proofData , revocationFSContribution );
166159 proofData = IdemixUtils .append (proofData , ipk .getHash ());
167160 proofData = IdemixUtils .append (proofData , disclosure );
168161 proofData = IdemixUtils .append (proofData , msg );
@@ -270,6 +263,12 @@ public boolean verify(boolean[] disclosure, IdemixIssuerPublicKey ipk, byte[] ms
270263 throw new IllegalArgumentException ("Attribute " + rhIndex + " is disclosed but also used a revocation handle attribute, which should remain hidden" );
271264 }
272265
266+ // Verify EpochPK
267+ if (!RevocationAuthority .verifyEpochPK (revPk , this .revocationPk , this .revocationPKSig , epoch , revocationAlgorithm )) {
268+ // Signature is based on an invalid revocation epoch public key
269+ return false ;
270+ }
271+
273272 FP12 temp1 = PAIR .ate (ipk .getW (), aPrime );
274273 FP12 temp2 = PAIR .ate (IdemixUtils .genG2 , aBar );
275274 temp2 .inverse ();
@@ -307,19 +306,18 @@ public boolean verify(boolean[] disclosure, IdemixIssuerPublicKey ipk, byte[] ms
307306 ECP t3 = ipk .getHsk ().mul2 (proofSSk , ipk .getHRand (), proofSRNym );
308307 t3 .sub (nym .mul (proofC ));
309308
310- // Involve the revocation verifier
311- RevocationVerifier revocationVerifier = RevocationVerifier . getVerifier (revocationAlgorithm );
309+ // Check with non-revoked- verifier
310+ NonRevocationVerifier nonRevokedVerifier = NonRevocationVerifier . getNonRevocationVerifier (revocationAlgorithm );
312311 int hiddenRHIndex = Ints .indexOf (hiddenIndices , rhIndex );
313312 if (hiddenRHIndex < 0 ) {
314313 // rhIndex is not present, set to last index position
315314 hiddenRHIndex = hiddenIndices .length ;
316315 }
317316 BIG proofSRh = proofSAttrs [hiddenRHIndex ];
318- byte [] revocationFSContribution = revocationVerifier .recomputeFSContribution (this .nonRevocationProof , proofC , IdemixUtils .transformFromProto (this .revocationPk ), proofSRh );
319- if (revocationFSContribution == null ) {
317+ byte [] nonRevokedProofBytes = nonRevokedVerifier .recomputeFSContribution (this .nonRevocationProof , proofC , IdemixUtils .transformFromProto (this .revocationPk ), proofSRh );
318+ if (nonRevokedProofBytes == null ) {
320319 return false ;
321320 }
322- // System.out.println(Arrays.toString(revocationFSContribution));
323321
324322 // create proofData such that it can contain the sign label, 7 elements in G1 (each of size 2*FIELD_BYTES+1),
325323 // the ipk hash, the disclosure array, and the message
@@ -332,7 +330,6 @@ public boolean verify(boolean[] disclosure, IdemixIssuerPublicKey ipk, byte[] ms
332330 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (aBar ));
333331 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (bPrime ));
334332 proofData = IdemixUtils .append (proofData , IdemixUtils .ecpToBytes (nym ));
335- proofData = IdemixUtils .append (proofData , revocationFSContribution );
336333 proofData = IdemixUtils .append (proofData , ipk .getHash ());
337334 proofData = IdemixUtils .append (proofData , disclosure );
338335 proofData = IdemixUtils .append (proofData , msg );
@@ -344,21 +341,7 @@ public boolean verify(boolean[] disclosure, IdemixIssuerPublicKey ipk, byte[] ms
344341 finalProofData = IdemixUtils .append (finalProofData , IdemixUtils .bigToBytes (nonce ));
345342
346343 byte [] hashedProofData = IdemixUtils .bigToBytes (IdemixUtils .hashModOrder (finalProofData ));
347- if (!Arrays .equals (IdemixUtils .bigToBytes (proofC ), hashedProofData )) {
348- // System.out.println("invalid proof");
349- return false ;
350- }
351-
352- // Check revocation
353- // - Epoch
354- if (this .epoch != epoch ) {
355- // System.out.println("different epoch");
356- return false ;
357- }
358-
359- // - EpochPk
360- RevocationAuthority ra = new RevocationAuthority (revPk );
361- return ra .verifyEpochPK (this .revocationPk , this .revocationPKSig , epoch , revocationAlgorithm );
344+ return Arrays .equals (IdemixUtils .bigToBytes (proofC ), hashedProofData );
362345 }
363346
364347 /**
0 commit comments