java.lang.Object
org.seppiko.commons.utils.crypto.spec.ParamterSpacUtil
ParamterSpac implement util
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DHParameterSpecgetDH(BigInteger p, BigInteger g) DHParameterSpec objectstatic DHParameterSpecgetDH(BigInteger p, BigInteger g, int l) DHParameterSpec objectstatic GCMParameterSpecgetGCM(int tLen, byte[] src) GCMParameterSpec objectstatic GCMParameterSpecgetGCM(int tLen, byte[] src, int off, int len) GCMParameterSpec objectstatic IvParameterSpecgetIV(byte[] iv) IvParameterSpec objectstatic IvParameterSpecgetIV(byte[] iv, int off, int len) IvParameterSpec objectstatic PBEParameterSpecgetPBE(byte[] salt, int iterationCount) PBEParameterSpec objectstatic PBEParameterSpecgetPBE(byte[] salt, int iterationCount, AlgorithmParameterSpec paramSpec) PBEParameterSpec object
-
Constructor Details
-
ParamterSpacUtil
public ParamterSpacUtil()
-
-
Method Details
-
getGCM
public static GCMParameterSpec getGCM(int tLen, byte[] src) throws NullPointerException, IllegalArgumentException GCMParameterSpec object- Parameters:
tLen- GCM authentication tag lengthsrc- the IV source buffer- Returns:
- GCMParameterSpec object
- Throws:
NullPointerException- src is nullIllegalArgumentException- if tLen is negative, src is null, len or offset is negative, or the sum of offset and len is greater than the length of the src byte array.- See Also:
-
getGCM
public static GCMParameterSpec getGCM(int tLen, byte[] src, int off, int len) throws IllegalArgumentException GCMParameterSpec object- Parameters:
tLen- GCM authentication tag lengthsrc- the IV source bufferoff- the offset in src where the IV startslen- the number of IV bytes- Returns:
- GCMParameterSpec object
- Throws:
IllegalArgumentException- if tLen is negative, src is null, len or offset is negative, or the sum of offset and len is greater than the length of the src byte array.- See Also:
-
getIV
IvParameterSpec object- Parameters:
iv- the buffer with the IV- Returns:
- IvParameterSpec object
- Throws:
NullPointerException- if iv is nullIllegalArgumentException- if iv is null or (iv.length - offset < len)ArrayIndexOutOfBoundsException- is thrown if offset or len index bytes outside the iv.- See Also:
-
getIV
IvParameterSpec object- Parameters:
iv- the buffer with the IVoff- the offset in iv where the IV startslen- the number of IV bytes- Returns:
- IvParameterSpec object
- Throws:
IllegalArgumentException- if iv is null or (iv.length - offset < len)ArrayIndexOutOfBoundsException- is thrown if offset or len index bytes outside the iv.- See Also:
-
getPBE
PBEParameterSpec object- Parameters:
salt- the salt. The contents of salt are copied to protect against subsequent modification.iterationCount- the iteration count.- Returns:
- PBEParameterSpec object
- Throws:
NullPointerException- if salt is null- See Also:
-
getPBE
public static PBEParameterSpec getPBE(byte[] salt, int iterationCount, AlgorithmParameterSpec paramSpec) throws NullPointerException PBEParameterSpec object- Parameters:
salt- the salt. The contents of salt are copied to protect against subsequent modification.iterationCount- the iteration count.paramSpec- the cipher algorithm parameter specification- Returns:
- PBEParameterSpec object
- Throws:
NullPointerException- if salt is null- See Also:
-
getDH
DHParameterSpec object- Parameters:
p- the prime modulusg- the base generator- Returns:
- DHParameterSpec object
- See Also:
-
getDH
DHParameterSpec object- Parameters:
p- the prime modulusg- the base generatorl- the size in bits of the random exponent (private value)- Returns:
- DHParameterSpec object
- See Also:
-