Package org.bouncycastle.jcajce.spec
Class AEADParameterSpec
java.lang.Object
javax.crypto.spec.IvParameterSpec
org.bouncycastle.jcajce.spec.AEADParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
ParameterSpec for AEAD modes which allows associated data to be added via an algorithm parameter spec.In normal
circumstances you would only want to use this if you had to work with the pre-JDK1.7 Cipher class as associated
data is ignored for the purposes of returning a Cipher's parameters.
-
Constructor Summary
ConstructorDescriptionAEADParameterSpec
(byte[] nonce, int macSizeInBits) Base constructor.AEADParameterSpec
(byte[] nonce, int macSizeInBits, byte[] associatedData) Base constructor with prepended associated data. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Return the associated data associated with this parameter spec.int
Return the size of the MAC associated with this parameter spec.byte[]
getNonce()
Return the nonce (same as IV) associated with this parameter spec.Methods inherited from class javax.crypto.spec.IvParameterSpec
getIV
-
Constructor Details
-
AEADParameterSpec
public AEADParameterSpec(byte[] nonce, int macSizeInBits) Base constructor.- Parameters:
nonce
- nonce/iv to be usedmacSizeInBits
- macSize in bits
-
AEADParameterSpec
public AEADParameterSpec(byte[] nonce, int macSizeInBits, byte[] associatedData) Base constructor with prepended associated data.- Parameters:
nonce
- nonce/iv to be usedmacSizeInBits
- macSize in bitsassociatedData
- associated data to be prepended to the cipher stream.
-
-
Method Details
-
getMacSizeInBits
public int getMacSizeInBits()Return the size of the MAC associated with this parameter spec.- Returns:
- the MAC size in bits.
-
getAssociatedData
public byte[] getAssociatedData()Return the associated data associated with this parameter spec.- Returns:
- the associated data, null if there isn't any.
-
getNonce
public byte[] getNonce()Return the nonce (same as IV) associated with this parameter spec.- Returns:
- the nonce/IV.
-