List of usage examples for org.bouncycastle.crypto.encodings OAEPEncoding processBlock
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
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);// ww w . j a v a 2 s. co m 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. c o 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/*from w w w . j a v a 2 s . c o m*/ // 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 ww. j av 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); }