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

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

Introduction

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

Prototype

public ECCurve getCurve() 

Source Link

Usage

From source file:com.fruitcat.bitcoin.Utils.java

License:Apache License

/**
 * Compress a point./*from   ww  w .j  a  va 2  s  . c  o  m*/
 * @param uncompressed
 * @return
 */
public static ECPoint compressPoint(ECPoint uncompressed) {
    return new ECPoint.Fp(uncompressed.getCurve(), uncompressed.getX(), uncompressed.getY(), true);
}

From source file:org.fdroid.enigtext.crypto.KeyUtil.java

License:Open Source License

private static AsymmetricCipherKeyPair cloneKeyPairWithPointCompression(AsymmetricCipherKeyPair keyPair) {
    ECPublicKeyParameters publicKey = (ECPublicKeyParameters) keyPair.getPublic();
    ECPoint q = publicKey.getQ();

    return new AsymmetricCipherKeyPair(
            new ECPublicKeyParameters(new ECPoint.Fp(q.getCurve(), q.getX(), q.getY(), true),
                    publicKey.getParameters()),
            keyPair.getPrivate());/*from w  w w. ja v a 2  s  .c  o m*/
}