Package org.bouncycastle.crypto.general
Class GeneralAuthParameters<T extends GeneralAuthParameters>
java.lang.Object
org.bouncycastle.crypto.general.GeneralParameters<GeneralAlgorithm>
org.bouncycastle.crypto.general.GeneralParametersWithIV<T>
org.bouncycastle.crypto.general.GeneralAuthParameters<T>
- Type Parameters:
T
- the actual parameters type that extends this class.
- All Implemented Interfaces:
AuthenticationParameters<T>
,AuthenticationParametersWithIV<T>
,Parameters
,ParametersWithIV<T>
- Direct Known Subclasses:
AES.AuthParameters
,ARIA.AuthParameters
,Blowfish.AuthParameters
,Camellia.AuthParameters
,CAST5.AuthParameters
,ChaCha20.AuthParameters
,DES.AuthParameters
,GOST28147.AuthParameters
,IDEA.AuthParameters
,Poly1305.AuthParameters
,RC2.AuthParameters
,SEED.AuthParameters
,Serpent.AuthParameters
,SHACAL2.AuthParameters
,TripleDES.AuthParameters
,Twofish.AuthParameters
public abstract class GeneralAuthParameters<T extends GeneralAuthParameters>
extends GeneralParametersWithIV<T>
implements AuthenticationParametersWithIV<T>
Base class for parameter classes for algorithms allow for authentication using MACs.
-
Field Summary
FieldsFields inherited from class org.bouncycastle.crypto.general.GeneralParametersWithIV
blockSize, iv
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GeneralAuthParameters
(GeneralAlgorithm algorithm, int blockSize, byte[] iv, int macSizeInBits) Base Constructor that takes an iv (nonce) and a tag length. -
Method Summary
Modifier and TypeMethodDescriptionprotected T
create
(GeneralAlgorithm algorithm, byte[] iv) int
Return the size of the MAC these parameters are for.withIV
(SecureRandom random, int ivLen) Return an implementation of our parameterized type with an IV constructed from the passed in SecureRandom.withMACSize
(int macSizeInBits) Create a parameter set with the specified MAC size associated with it.Methods inherited from class org.bouncycastle.crypto.general.GeneralParametersWithIV
getIV, withIV, withIV
Methods inherited from class org.bouncycastle.crypto.general.GeneralParameters
getAlgorithm
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bouncycastle.crypto.Parameters
getAlgorithm
Methods inherited from interface org.bouncycastle.crypto.ParametersWithIV
getIV, withIV, withIV
-
Field Details
-
macLenInBits
protected final int macLenInBits
-
-
Constructor Details
-
GeneralAuthParameters
protected GeneralAuthParameters(GeneralAlgorithm algorithm, int blockSize, byte[] iv, int macSizeInBits) Base Constructor that takes an iv (nonce) and a tag length.- Parameters:
algorithm
- algorithm mode.blockSize
- block size of the cipher in bytes.iv
- iv, or nonce, to be used with this algorithm.macSizeInBits
- length of the checksum tag in bits.
-
-
Method Details
-
getMACSizeInBits
public int getMACSizeInBits()Return the size of the MAC these parameters are for.- Specified by:
getMACSizeInBits
in interfaceAuthenticationParameters<T extends GeneralAuthParameters>
- Returns:
- the MAC size in bits.
-
withIV
Return an implementation of our parameterized type with an IV constructed from the passed in SecureRandom.- Specified by:
withIV
in interfaceAuthenticationParametersWithIV<T extends GeneralAuthParameters>
- Parameters:
random
- the SecureRandom to use as the source of IV data.ivLen
- the length (in bytes) of the IV to be generated.- Returns:
- a new instance of our parameterized type with a new IV.
-
withMACSize
Create a parameter set with the specified MAC size associated with it.- Specified by:
withMACSize
in interfaceAuthenticationParameters<T extends GeneralAuthParameters>
- Parameters:
macSizeInBits
- bit length of the MAC length.- Returns:
- the new parameter set.
-
create
-