Example usage for org.bouncycastle.jce.spec ECPrivateKeySpec getD

List of usage examples for org.bouncycastle.jce.spec ECPrivateKeySpec getD

Introduction

In this page you can find the example usage for org.bouncycastle.jce.spec ECPrivateKeySpec getD.

Prototype

public BigInteger getD() 

Source Link

Document

return the private number D

Usage

From source file:jpcsp.crypto.ECDSA.java

License:Open Source License

public byte[] multiplyPublicKey(byte[] pub, byte[] priv) {
    PublicKey multPubKey = null;//from ww  w. j av  a 2s.c  o  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();
}