Package org.cryptacular.spec
Class BufferedBlockCipherSpec
java.lang.Object
org.cryptacular.spec.BufferedBlockCipherSpec
- All Implemented Interfaces:
Spec<org.bouncycastle.crypto.BufferedBlockCipher>
- Direct Known Subclasses:
KeyedBlockCipherSpec
public class BufferedBlockCipherSpec
extends Object
implements Spec<org.bouncycastle.crypto.BufferedBlockCipher>
Describes a block cipher in terms of a (algorithm, mode, padding) tuple and provides a facility to create a new
instance of the cipher via the
newInstance()
method.- Version:
- $Revision: 2744 $
- Author:
- Middleware Services
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBufferedBlockCipherSpec
(String algName) Creates a new instance from an algorithm name.BufferedBlockCipherSpec
(String algName, String cipherMode) Creates a new instance from a cipher algorithm and mode.BufferedBlockCipherSpec
(String algName, String cipherMode, String cipherPadding) Creates a new instance from the given cipher specifications. -
Method Summary
Modifier and TypeMethodDescriptionGets the simple block cipher specification corresponding to this instance.getMode()
Gets the cipher mode.Gets the cipher padding scheme.org.bouncycastle.crypto.BufferedBlockCipher
Creates a new buffered block cipher from the specification in this instance.static BufferedBlockCipherSpec
Parses a string representation of a buffered block cipher specification into an instance of this class.toString()
-
Field Details
-
FORMAT
String specification format,algorithm/mode/padding
.
-
-
Constructor Details
-
BufferedBlockCipherSpec
Creates a new instance from an algorithm name.- Parameters:
algName
- Cipher algorithm name.
-
BufferedBlockCipherSpec
Creates a new instance from a cipher algorithm and mode.- Parameters:
algName
- Cipher algorithm name.cipherMode
- Cipher mode.
-
BufferedBlockCipherSpec
Creates a new instance from the given cipher specifications.- Parameters:
algName
- Cipher algorithm name.cipherMode
- Cipher mode.cipherPadding
- Cipher padding scheme algorithm.
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithm
in interfaceSpec<org.bouncycastle.crypto.BufferedBlockCipher>
- Returns:
- Cryptographic algorithm name.
-
getMode
Gets the cipher mode.- Returns:
- Cipher mode, e.g. CBC, OFB.
-
getPadding
Gets the cipher padding scheme.- Returns:
- Padding scheme algorithm, e.g. PKCS5Padding. The following names are equivalent for no padding: NULL, Zero, None.
-
getBlockCipherSpec
Gets the simple block cipher specification corresponding to this instance.- Returns:
- Simple block cipher specification.
-
newInstance
public org.bouncycastle.crypto.BufferedBlockCipher newInstance()Creates a new buffered block cipher from the specification in this instance.- Specified by:
newInstance
in interfaceSpec<org.bouncycastle.crypto.BufferedBlockCipher>
- Returns:
- New buffered block cipher instance.
-
toString
-
parse
Parses a string representation of a buffered block cipher specification into an instance of this class.- Parameters:
specification
- Block cipher specification of the formalgorithm/mode/padding
.- Returns:
- Buffered block cipher specification instance.
-