List of usage examples for org.bouncycastle.crypto.engines RSABlindedEngine getInputBlockSize
public int getInputBlockSize()
From source file:org.fnppl.opensdx.security.PrivateKey.java
License:Open Source License
public byte[] decrypt(byte[] data) throws Exception { RSABlindedEngine rsae = new RSABlindedEngine(); OAEPEncoding oaep = new OAEPEncoding(rsae); oaep.init(false, //fr encrypt: true // bp priv);//from ww w.ja v a 2s .com if (data.length > rsae.getInputBlockSize()) { throw new RuntimeException("PrivateKey.encrypt::data.length(" + data.length + ") too long - max is: " + rsae.getInputBlockSize()); } return oaep.processBlock(data, 0, data.length); }
From source file:org.fnppl.opensdx.security.PrivateKey.java
License:Open Source License
public byte[] encrypt(byte[] data) throws Exception { RSABlindedEngine rsae = new RSABlindedEngine(); // RSABlindingEngine rsae = new RSABlindingEngine(); // /*from w w w . j a va 2 s . co m*/ // RSABlindingParameters bp = new RSABlindingParameters( // priv, // PublicKey.generateBlindingFactor(pubkey) // ); OAEPEncoding oaep = new OAEPEncoding(rsae); oaep.init(true, //fr encrypt: true // bp priv); if (data.length > rsae.getInputBlockSize()) { throw new RuntimeException("PrivateKey.encrypt::data.length(" + data.length + ") too long - max is: " + rsae.getInputBlockSize()); } return oaep.processBlock(data, 0, data.length); }
From source file:org.fnppl.opensdx.security.PublicKey.java
License:Open Source License
public byte[] encrypt(byte[] data) throws Exception { // RSABlindingEngine rsae = new RSABlindingEngine(); RSABlindedEngine rsab = new RSABlindedEngine(); // RSABlindingParameters bp = new RSABlindingParameters( // pub, // generateBlindingFactor(pub) // ); // OAEPEncoding oaep = new OAEPEncoding(rsae); OAEPEncoding oaep = new OAEPEncoding(rsab); oaep.init(true, //fr encrypt: true pub/* ww w . j a v a2 s.c om*/ // bp ); if (data.length > rsab.getInputBlockSize()) { throw new RuntimeException("PublicKey.encrypt::data.length(" + data.length + ") too long - max is: " + oaep.getInputBlockSize()); } return oaep.processBlock(data, 0, data.length); }
From source file:org.fnppl.opensdx.security.PublicKey.java
License:Open Source License
public byte[] decrypt(byte[] data) throws Exception { // RSABlindingEngine rsae = new RSABlindingEngine(); RSABlindedEngine rsae = new RSABlindedEngine(); // RSABlindingParameters bp = new RSABlindingParameters( // pub, // generateBlindingFactor(pub) // ); OAEPEncoding oaep = new OAEPEncoding(rsae); oaep.init(false, //fr encrypt: true pub/* w w w .j a v a 2 s . c o m*/ // bp ); if (data.length > rsae.getInputBlockSize()) { throw new RuntimeException("PublicKey.decrypt::data.length(" + data.length + ") too long - max is: " + oaep.getInputBlockSize()); } return oaep.processBlock(data, 0, data.length); }