org.cryptacular.spec.KeyedBlockCipherSpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cryptacular Show documentation
Show all versions of cryptacular Show documentation
The spectacular complement to the Bouncy Castle crypto API for Java.
/* See LICENSE for licensing and NOTICE for copyright. */
package org.cryptacular.spec;
/**
* Describes a block cipher algorithm with a known key size.
*
* @author Middleware Services
*/
public class KeyedBlockCipherSpec extends BufferedBlockCipherSpec
{
/** Key length in bits. */
private final int keyLength;
/**
* Creates a new instance from the given cipher specifications.
*
* @param algName Cipher algorithm name.
* @param cipherMode Cipher mode.
* @param cipherPadding Cipher padding scheme algorithm.
* @param keyBitLength Key length in bits.
*/
public KeyedBlockCipherSpec(
final String algName,
final String cipherMode,
final String cipherPadding,
final int keyBitLength)
{
super(algName, cipherMode, cipherPadding);
if (keyBitLength < 0) {
throw new IllegalArgumentException("Key length must be non-negative");
}
this.keyLength = keyBitLength;
}
/**
* Gets the cipher key length in bits.
*
* @return Key length in bits.
*/
public int getKeyLength()
{
return keyLength;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy