org.bouncycastle.crypto.modes.CFBBlockCipher Java Examples

The following examples show how to use org.bouncycastle.crypto.modes.CFBBlockCipher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CryptManager.java    From FishingBot with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new BufferedBlockCipher instance
 */
private static BufferedBlockCipher createBufferedBlockCipher(boolean par0, Key par1Key) {
    BufferedBlockCipher var2 = new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 8));
    var2.init(par0, new ParametersWithIV(new KeyParameter(par1Key.getEncoded()), par1Key.getEncoded(), 0, 16));
    return var2;
}
 
Example #2
Source File: EncryptionUtil.java    From AIBot with GNU General Public License v3.0 4 votes vote down vote up
public static BufferedBlockCipher createBlockCipher(SecretKey key, boolean out) {
	BufferedBlockCipher blockCipher = new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 8));
	blockCipher.init(out, new ParametersWithIV(new KeyParameter(key.getEncoded()), key.getEncoded(), 0, 16));
	return blockCipher;
}
 
Example #3
Source File: ChunkListDecrypter.java    From InflatableDonkey with MIT License 4 votes vote down vote up
CipherInputStream cipherInputStream(InputStream inputStream, byte[] key, byte[] checksum) {
    CFBBlockCipher cipher = new CFBBlockCipher(new AESFastEngine(), 128);
    KeyParameter keyParameter = new KeyParameter(key);
    cipher.init(false, keyParameter);
    return new CipherInputStream(inputStream, cipher);
}
 
Example #4
Source File: ChunkDecrypter.java    From LiquidDonkey with MIT License 4 votes vote down vote up
/**
 * Returns a new instance.
 *
 * @return a new instance, not null
 */
public static ChunkDecrypter create() {
    return new ChunkDecrypter(
            new CFBBlockCipher(new AESEngine(), 128),
            new SHA256Digest());
}
 
Example #5
Source File: EncryptionUtil.java    From DarkBot with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static BufferedBlockCipher createBlockCipher(SecretKey key, boolean out) {
	BufferedBlockCipher blockCipher = new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 8));
	blockCipher.init(out, new ParametersWithIV(new KeyParameter(key.getEncoded()), key.getEncoded(), 0, 16));
	return blockCipher;
}
 
Example #6
Source File: BlowfishCipher.java    From panama with MIT License 3 votes vote down vote up
/**
 * <b>Notice: </b><br>
 * 1. in <code>new CFBBlockCipher(engine, <b>8</b> * 8);</code> the IV length (8) is
 * reference to the shadowsocks's design.
 *
 * @see <a href="https://shadowsocks.org/en/spec/cipher.html">
 * https://shadowsocks.org/en/spec/cipher.html</a>#Cipher
 */
public BlowfishCipher(String password, int mode) {
    key = new SecretKeySpec(password.getBytes(), "BF");
    keyLength = mode;
    BlowfishEngine engine = new BlowfishEngine();
    cipher = new CFBBlockCipher(engine, 8 * 8);
}
 
Example #7
Source File: BlowfishCipher.java    From AgentX with Apache License 2.0 3 votes vote down vote up
/**
 * <b>Notice: </b><br>
 * 1. in <code>new CFBBlockCipher(engine, <b>8</b> * 8);</code> the IV length (8) is
 * reference to the shadowsocks's design.
 *
 * @see <a href="https://shadowsocks.org/en/spec/cipher.html">
 * https://shadowsocks.org/en/spec/cipher.html</a>#Cipher
 */
public BlowfishCipher(String password, int mode) {
    key = new SecretKeySpec(password.getBytes(), "BF");
    keyLength = mode;
    BlowfishEngine engine = new BlowfishEngine();
    cipher = new CFBBlockCipher(engine, 8 * 8);
}