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

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

Introduction

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

Prototype

public ECPoint normalize() 

Source Link

Document

Normalization ensures that any projective coordinate is 1, and therefore that the x, y coordinates reflect those of the equivalent point in an affine coordinate system.

Usage

From source file:de.tsenger.animamea.ca.ChipAuthenticationECDH.java

License:Open Source License

@Override
public byte[] getSharedSecret_K(PrivateKey ephskpcd, byte[] pkpicc) {
    ;/* w  w  w  .  j a  v a 2 s  .co  m*/
    BigInteger privKey = ((ECPrivateKey) ephskpcd).getD();
    PK_PICC = byteArrayToECPoint(pkpicc, curve);

    ECPoint.Fp K = (Fp) PK_PICC.multiply(privKey);
    byte[] sharedSecret_K = bigIntToByteArray(K.normalize().getXCoord().toBigInteger());
    return sharedSecret_K;
}

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

License:Open Source License

@Override
public byte[] getSharedSecret_K(byte[] Y2) {

    ECPoint PICC_PK_Y2 = byteArrayToECPoint(Y2, curve);
    ECPoint.Fp K = (Fp) PICC_PK_Y2.multiply(PCD_SK_x2);
    return bigIntToByteArray(K.normalize().getXCoord().toBigInteger());
}