Example usage for org.bouncycastle.jce.spec ECPublicKeySpec getQ

List of usage examples for org.bouncycastle.jce.spec ECPublicKeySpec getQ

Introduction

In this page you can find the example usage for org.bouncycastle.jce.spec ECPublicKeySpec getQ.

Prototype

public ECPoint getQ() 

Source Link

Document

return the public point q

Usage

From source file:jpcsp.crypto.ECDSA.java

License:Open Source License

public byte[] multiplyPublicKey(byte[] pub, byte[] priv) {
    PublicKey multPubKey = null;/* w  ww  .j  av a  2s.co  m*/
    ECPrivateKeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(priv), spec);
    ECPublicKeySpec publicKeySpec = new ECPublicKeySpec(curve.decodePoint(pub), spec);
    ECPublicKeySpec newPublicKeySpec = new ECPublicKeySpec(publicKeySpec.getQ().multiply(privateKeySpec.getD()),
            spec);
    try {
        multPubKey = f.generatePublic(newPublicKeySpec);
    } catch (Exception e) {
    }
    return multPubKey.getEncoded();
}