com.google.bitcoin.bouncycastle.crypto.params.DHPublicKeyParameters

Here are the examples of the java api class com.google.bitcoin.bouncycastle.crypto.params.DHPublicKeyParameters taken from open source projects.

1. DHBasicAgreement#calculateAgreement()

Project: bitcoin-android
File: DHBasicAgreement.java
/**
     * given a short term public key from a given party calculate the next
     * message in the agreement sequence. 
     */
public BigInteger calculateAgreement(CipherParameters pubKey) {
    DHPublicKeyParameters pub = (DHPublicKeyParameters) pubKey;
    if (!pub.getParameters().equals(dhParams)) {
        throw new IllegalArgumentException("Diffie-Hellman public key has wrong parameters.");
    }
    return pub.getY().modPow(key.getX(), dhParams.getP());
}