Package org.bouncycastle.bcpg
Class AEADUtils
- java.lang.Object
-
- org.bouncycastle.bcpg.AEADUtils
-
- All Implemented Interfaces:
AEADAlgorithmTags
public class AEADUtils extends java.lang.Object implements AEADAlgorithmTags
-
-
Field Summary
-
Fields inherited from interface org.bouncycastle.bcpg.AEADAlgorithmTags
EAX, GCM, OCB
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getAuthTagLength(int aeadAlgorithmTag)
Return the length of the authentication tag used by the given AEAD algorithm in octets.static int
getIVLength(int aeadAlgorithmTag)
Return the length of the IV used by the given AEAD algorithm in octets.static byte[][]
splitMessageKeyAndIv(byte[] messageKeyAndIv, int cipherAlgo, int aeadAlgo)
Split a given byte array containing m
-
-
-
Method Detail
-
getIVLength
public static int getIVLength(int aeadAlgorithmTag)
Return the length of the IV used by the given AEAD algorithm in octets.- Parameters:
aeadAlgorithmTag
- AEAD algorithm identifier- Returns:
- length of the IV
-
getAuthTagLength
public static int getAuthTagLength(int aeadAlgorithmTag)
Return the length of the authentication tag used by the given AEAD algorithm in octets.- Parameters:
aeadAlgorithmTag
- AEAD algorithm identifier- Returns:
- length of the auth tag
-
splitMessageKeyAndIv
public static byte[][] splitMessageKeyAndIv(byte[] messageKeyAndIv, int cipherAlgo, int aeadAlgo)
Split a given byte array containing m bytes of key and n-8 bytes of IV into two separate byte arrays. m is the key length of the cipher algorithm, while n is the IV length of the AEAD algorithm. Note, that the IV is filled with n-8 bytes only, the remainder is left as 0s. Return an array of both arrays with the key and index 0 and the IV at index 1.- Parameters:
messageKeyAndIv
- m+n-8 bytes of concatenated message key and IVcipherAlgo
- symmetric cipher algorithmaeadAlgo
- AEAD algorithm- Returns:
- array of arrays containing message key and IV
-
-