Example usage for org.bouncycastle.crypto.engines RSAEngine getInputBlockSize

List of usage examples for org.bouncycastle.crypto.engines RSAEngine getInputBlockSize

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.engines RSAEngine getInputBlockSize.

Prototype

public int getInputBlockSize() 

Source Link

Document

Return the maximum size for an input block to this engine.

Usage

From source file:org.fnppl.opensdx.security.PrivateKey.java

License:Open Source License

public byte[] sign(byte[] data) throws Exception {
    RSAEngine rsae = new RSAEngine();
    rsae.init(false, priv);//  w w w  . ja v  a 2s .  c  om
    byte[] filleddata = new byte[rsae.getInputBlockSize() - 1];
    for (int i = 0; i < filleddata.length; i++) {
        filleddata[i] = data[i % data.length];//HT 2011-03-03 better some initvectorpadddup!!!
    }

    //System.out.println("PrivKey_SIGN_PLAINBLOATED:\t"+SecurityHelper.HexDecoder.encode(filleddata, ':', 80));

    return rsae.processBlock(filleddata, 0, filleddata.length);
}