List of usage examples for org.bouncycastle.crypto BufferedBlockCipher getUnderlyingCipher
public BlockCipher getUnderlyingCipher()
From source file:org.cryptacular.bean.BufferedBlockCipherBean.java
License:Open Source License
@Override protected BufferedBlockCipherAdapter newCipher(final CiphertextHeader header, final boolean mode) { final BufferedBlockCipher cipher = blockCipherSpec.newInstance(); CipherParameters params = new KeyParameter(lookupKey(header.getKeyName()).getEncoded()); final String algName = cipher.getUnderlyingCipher().getAlgorithmName(); if (algName.endsWith("CBC") || algName.endsWith("OFB") || algName.endsWith("CFB")) { params = new ParametersWithIV(params, header.getNonce()); }/*from w w w . java 2s . c o m*/ cipher.init(mode, params); return new BufferedBlockCipherAdapter(cipher); }