// Store the public value to send to server
this.Yc = ((DHPublicKeyParameters)dhPair.getPublic()).getY();
// Calculate the shared secret
DHBasicAgreement dhAgree = new DHBasicAgreement();
dhAgree.init(dhPair.getPrivate());
BigInteger agreement = dhAgree.calculateAgreement(new DHPublicKeyParameters(Ys, dhParams));
this.pms = BigIntegers.asUnsignedByteArray(agreement);
}