org.bouncycastle.crypto.StreamBlockCipher Java Examples
The following examples show how to use
org.bouncycastle.crypto.StreamBlockCipher.
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: CredStashBouncyCastleCrypto.java From jcredstash with Apache License 2.0 | 6 votes |
private byte[] encryptOrDecrypt(byte[] key, byte[] contents, boolean forEncryption) { // Credstash uses standard AES BlockCipher engine = new AESFastEngine(); // Credstash uses CTR mode StreamBlockCipher cipher = new SICBlockCipher(engine); cipher.init(forEncryption, new ParametersWithIV(new KeyParameter(key), INITIALIZATION_VECTOR)); byte[] resultBytes = new byte[contents.length]; int contentsOffset = 0; int resultOffset = 0; cipher.processBytes(contents, contentsOffset, contents.length, resultBytes, resultOffset); return resultBytes; }
Example #2
Source File: AESCrypto.java From shadowsocks-vertx with Apache License 2.0 | 5 votes |
@Override protected StreamCipher createCipher(byte[] iv, boolean encrypt) { StreamBlockCipher c = getCipher(encrypt); ParametersWithIV parameterIV = new ParametersWithIV(new KeyParameter(mKey), iv, 0, mIVLength); c.init(encrypt, parameterIV); return c; }
Example #3
Source File: CryptBase.java From NSS with Apache License 2.0 | 4 votes |
protected abstract StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException;
Example #4
Source File: ChunkDecrypter.java From LiquidDonkey with MIT License | 4 votes |
ChunkDecrypter(StreamBlockCipher cfbAes, GeneralDigest digest) { this.cfbAes = Objects.requireNonNull(cfbAes); this.digest = Objects.requireNonNull(digest); }