Example usage for org.bouncycastle.math.ec ECPoint subtract

List of usage examples for org.bouncycastle.math.ec ECPoint subtract

Introduction

In this page you can find the example usage for org.bouncycastle.math.ec ECPoint subtract.

Prototype

public abstract ECPoint subtract(ECPoint b);

Source Link

Usage

From source file:com.example.quangadmin.smsencrypfinal.Khoigiaima.Makhoa.java

public void Giaima2(BigInteger r, BigInteger v, BigInteger m, ECPoint Pc1, ECPoint Pc2, ECPoint PublicKEYSender,
        BigInteger PrivateKEYReceiver) {
    BigInteger w = v.modInverse(ecc.getQ());
    BigInteger vvv;/* ww  w  .  ja v a2 s  . c  om*/
    BigInteger u1 = m.multiply(w).mod(ecc.getQ());
    BigInteger u2 = r.multiply(w).mod(ecc.getQ());

    ECPoint X = (ecc.getG().multiply(u1)).add(PublicKEYSender.multiply(u2));
    if (X == null) {
        this.verify = false;
    } else {
        vvv = X.getX().toBigInteger().mod(ecc.getQ());
        if (vvv.equals(r)) {
            this.verify = true;
        }
    }
    ECPoint Pm = Pc2.subtract(Pc1.multiply(PrivateKEYReceiver));
    aes.Decryp(m.toByteArray(), new SHA256().SHA256(Pm));
    this.plaintext = aes.getPlaintext();
}