Class SecretKeyUtil
- java.lang.Object
-
- hu.icellmobilsoft.coffee.tool.utils.crypto.SecretKeyUtil
-
public class SecretKeyUtil extends Object
Cryptography key handling util- Since:
- 2.5.0
- Author:
- imre.scheffer
-
-
Field Summary
Fields Modifier and Type Field Description static StringALGORITHM_AESAES valuestatic intITERATIONDefault iterationstatic intKEY_LENGTHEncoded velua lengthstatic byte[]SALTDefault saltstatic StringSECRET_KEY_ALGORITHMSecret key algorithm
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SecretKeySpecAES256SecretKeySpec(char[] password, byte[] salt, int iteration, int keyLength, String secretKeyFactoryAlgorithm, String secretKeySpecAlgorithm)Create secret keystatic SecretKeySpecdefaultAES256SecretKeySpec(char[] password)Create secret key, where the following values are set: SALT: { 0 } ITERATION: 1000 KEY_LENGTH: 256 SECRET_KEY_ALGORITHM: "PBKDF2WithHmacSHA1" ALGORITHM_AES: "AES"
-
-
-
Field Detail
-
SALT
public static final byte[] SALT
Default salt
-
ITERATION
public static final int ITERATION
Default iteration- See Also:
- Constant Field Values
-
KEY_LENGTH
public static final int KEY_LENGTH
Encoded velua length- See Also:
- Constant Field Values
-
SECRET_KEY_ALGORITHM
public static final String SECRET_KEY_ALGORITHM
Secret key algorithm- See Also:
- Constant Field Values
-
ALGORITHM_AES
public static final String ALGORITHM_AES
AES value- See Also:
- Constant Field Values
-
-
Method Detail
-
defaultAES256SecretKeySpec
public static SecretKeySpec defaultAES256SecretKeySpec(char[] password) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Create secret key, where the following values are set:- SALT: { 0 }
- ITERATION: 1000
- KEY_LENGTH: 256
- SECRET_KEY_ALGORITHM: "PBKDF2WithHmacSHA1"
- ALGORITHM_AES: "AES"
- Parameters:
password- string to encode- Returns:
SecretKeySpec- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- any exception
-
AES256SecretKeySpec
public static SecretKeySpec AES256SecretKeySpec(char[] password, byte[] salt, int iteration, int keyLength, String secretKeyFactoryAlgorithm, String secretKeySpecAlgorithm) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Create secret key- Parameters:
password- string to encodesalt- salt sourceiteration- iteration countkeyLength- he to-be-derived key lengthsecretKeyFactoryAlgorithm- the standard name of the requested secret-key algorithmsecretKeySpecAlgorithm- the name of the secret-key algorithm to be associated with the given key material.- Returns:
- secret key from the given byte array
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- any exception
-
-