本文整理汇总了Java中org.bouncycastle.crypto.StreamBlockCipher类的典型用法代码示例。如果您正苦于以下问题:Java StreamBlockCipher类的具体用法?Java StreamBlockCipher怎么用?Java StreamBlockCipher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StreamBlockCipher类属于org.bouncycastle.crypto包,在下文中一共展示了StreamBlockCipher类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encryptOrDecrypt
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
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;
}
示例2: CTSBlockCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
/**
* Create a buffered block cipher that uses Cipher Text Stealing
*
* @param cipher the underlying block cipher this buffering object wraps.
*/
public CTSBlockCipher(
BlockCipher cipher)
{
if (cipher instanceof StreamBlockCipher)
{
throw new IllegalArgumentException("CTSBlockCipher can only accept ECB, or CBC ciphers");
}
this.cipher = cipher;
blockSize = cipher.getBlockSize();
buf = new byte[blockSize * 2];
bufOff = 0;
}
示例3: JCEStreamCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
protected JCEStreamCipher(
BlockCipher engine,
int ivLength)
{
this.ivLength = ivLength;
cipher = new StreamBlockCipher(engine);
}
示例4: BaseStreamCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
protected BaseStreamCipher(
BlockCipher engine,
int ivLength)
{
this.ivLength = ivLength;
cipher = new StreamBlockCipher(engine);
}
示例5: createCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
@Override
protected StreamCipher createCipher(byte[] iv, boolean encrypt) throws CryptoException
{
StreamBlockCipher c = getCipher(encrypt);
ParametersWithIV parameterIV = new ParametersWithIV(new KeyParameter(mKey), iv, 0, mIVLength);
c.init(encrypt, parameterIV);
return c;
}
示例6: getCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
protected abstract StreamBlockCipher getCipher(boolean isEncrypted)
throws InvalidAlgorithmParameterException;
示例7: ChunkDecrypter
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
ChunkDecrypter(StreamBlockCipher cfbAes, GeneralDigest digest) {
this.cfbAes = Objects.requireNonNull(cfbAes);
this.digest = Objects.requireNonNull(digest);
}
示例8: getCipher
import org.bouncycastle.crypto.StreamBlockCipher; //导入依赖的package包/类
protected abstract StreamBlockCipher getCipher(boolean isEncrypted) throws InvalidAlgorithmParameterException;