Example usage for org.bouncycastle.crypto BufferedBlockCipher getUnderlyingCipher

List of usage examples for org.bouncycastle.crypto BufferedBlockCipher getUnderlyingCipher

Introduction

In this page you can find the example usage for org.bouncycastle.crypto BufferedBlockCipher getUnderlyingCipher.

Prototype

public BlockCipher getUnderlyingCipher() 

Source Link

Document

return the cipher this object wraps.

Usage

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);
}