Example usage for org.bouncycastle.crypto.paddings BlockCipherPadding getPaddingName

List of usage examples for org.bouncycastle.crypto.paddings BlockCipherPadding getPaddingName

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.paddings BlockCipherPadding getPaddingName.

Prototype

public String getPaddingName();

Source Link

Document

Return the name of the algorithm the cipher implements.

Usage

From source file:org.xwiki.crypto.cipher.internal.symmetric.BcPaddedSymmetricCipher.java

License:Open Source License

/**
 * Generic Bouncy Castle based block cipher with padding.
 * @param cipher the block cipher to encapsulate.
 * @param forEncryption true if the block cipher is setup for encryption.
 * @param padding the padding to apply.//from w  w  w .j  a  va  2  s . co  m
 * @param parameters parameters to initialize the cipher.
 */
public BcPaddedSymmetricCipher(BlockCipher cipher, boolean forEncryption, CipherParameters parameters,
        BlockCipherPadding padding) {
    super(new PaddedBufferedBlockCipher(cipher, padding), forEncryption, parameters);
    paddingName = padding.getPaddingName() + PADDING;
    if (PKCS7_PADDING.equals(paddingName) && getOutputBlockSize() <= 8) {
        paddingName = PKCS5_PADDING;
    }
}