View Javadoc
1   package civitas.crypto.keyshare;
2   
3   import org.springframework.beans.factory.annotation.Autowired;
4   import org.springframework.stereotype.Controller;
5   
6   import civitas.crypto.proofknowndisclog.ElGamalProofKnowDiscLog;
7   import civitas.crypto.proofknowndisclog.VerifyElGamalProofKnowDiscLog;
8   import civitas.crypto.publickey.ElGamalPublicKey;
9   
10  @Controller
11  public class VerifyElGamalKeyShare {
12  
13  	@Autowired
14  	VerifyElGamalProofKnowDiscLog verifyElGamalProofKnowDiscLog;
15  
16  	public boolean apply(final ElGamalKeyShare that) {
17  		ElGamalProofKnowDiscLog prf = that.proof();
18  		ElGamalPublicKey key = that.pubKey();
19  		return prf.v().equals(key.y) && verifyElGamalProofKnowDiscLog.apply(prf, that.pubKey().params);
20  	}
21  }