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
,Blowfish.AuthParameters
,Camellia.AuthParameters
,CAST5.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
Fields Modifier and Type Field Description protected int
macLenInBits
-
Fields inherited from class org.bouncycastle.crypto.general.GeneralParametersWithIV
blockSize, iv
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GeneralAuthParameters(GeneralAlgorithm algorithm, int blockSize, byte[] iv, int macSizeInBits)
Base Constructor that takes an iv (nonce) and a tag length.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
create(GeneralAlgorithm algorithm, byte[] iv)
int
getMACSizeInBits()
Return the size of the MAC these parameters are for.T
withIV(java.security.SecureRandom random, int ivLen)
Return an implementation of our parameterized type with an IV constructed from the passed in SecureRandom.T
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
-
-
-
-
Constructor Detail
-
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 Detail
-
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
public T withIV(java.security.SecureRandom random, int ivLen)
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
public T withMACSize(int macSizeInBits)
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
protected T create(GeneralAlgorithm algorithm, byte[] iv)
-
-