Example usage for org.bouncycastle.math.ec ECPoint.Fp multiply

List of usage examples for org.bouncycastle.math.ec ECPoint.Fp multiply

Introduction

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

Prototype

public ECPoint multiply(BigInteger k) 

Source Link

Document

Multiplies this ECPoint by the given number.

Usage

From source file:de.tsenger.animamea.pace.PaceECDH.java

License:Open Source License

/**
 * Berechnet mit Hilfe des ffentlichen Schlssels der Karte das erste
 * Shared Secret P, den neuen Punkt G', sowie den zweiten ffentlichen
 * Schlssels des Terminals (X2 = x2 * G').
 * /*from   w  w w  .ja  va 2s  .co m*/
 * @param Y1
 *            Erster ffentlicher Schlssel der Karte
 * @return Zweiter ffentlicher Schlssel X2 des Terminals.
 */
private ECPoint getX2(ECPoint.Fp Y1) {

    ECPoint.Fp SharedSecret_P = (Fp) Y1.multiply(PCD_SK_x1);
    System.out.println("\nP: " + HexString.bufferToHex(SharedSecret_P.getEncoded()));
    ECPoint pointG_strich = pointG.multiply(nonce_s).add(SharedSecret_P);
    System.out.println("\nG_strich: " + HexString.bufferToHex(pointG_strich.getEncoded()));
    byte[] x2 = new byte[(curve.getFieldSize() / 8)];
    randomGenerator.nextBytes(x2);
    PCD_SK_x2 = new BigInteger(1, x2);

    ECPoint PCD_PK_X2 = pointG_strich.multiply(PCD_SK_x2);

    return PCD_PK_X2;
}