Class AesCbcCryptoUtil
- java.lang.Object
-
- hu.icellmobilsoft.coffee.tool.utils.crypto.AesCbcCryptoUtil
-
public class AesCbcCryptoUtil extends Object
AES/CBC/PKCS5PADDING coding- Since:
- 2.5.0
- Author:
- imre.scheffer
-
-
Field Summary
Fields Modifier and Type Field Description static StringCIPHER_TRANSFORMATIONCipher transformation algotithmstatic byte[]DEFAULT_VECTORDefault zero initial vector
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]decrypt(byte[] encryptedData, char[] key)Decrypt data with parameters, initial vector is default zerostatic byte[]decrypt(byte[] encryptedData, char[] key, String initVector)Decrypt data with parametersstatic InputStreamdecrypt(InputStream encryptedData, char[] key)Decrypt data with parameters, initial vector is default zerostatic InputStreamdecrypt(InputStream encryptedData, char[] key, String initVector)Decrypt data with parametersstatic byte[]encrypt(byte[] dataToEncrypt, char[] key)Encrypt data with parameters, initial vector is default zerostatic byte[]encrypt(byte[] dataToEncrypt, char[] key, String initVector)Encrypt data with parametersstatic InputStreamencrypt(InputStream dataToEncrypt, char[] key)Encrypt data with parameters, initial vector is default zerostatic InputStreamencrypt(InputStream dataToEncrypt, char[] key, String initVector)Encrypt data with parametersstatic Stringto16LengthInitVector(String sourceString)Truncate/expand InitVector source string to 16-length string
-
-
-
Field Detail
-
DEFAULT_VECTOR
public static final byte[] DEFAULT_VECTOR
Default zero initial vector
-
CIPHER_TRANSFORMATION
public static final String CIPHER_TRANSFORMATION
Cipher transformation algotithm- See Also:
- Constant Field Values
-
-
Method Detail
-
encrypt
public static byte[] encrypt(byte[] dataToEncrypt, char[] key) throws hu.icellmobilsoft.coffee.dto.exception.BaseExceptionEncrypt data with parameters, initial vector is default zero- Parameters:
dataToEncrypt- data to encryptkey- encrypting key- Returns:
- encrypted data in byte[]
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
encrypt
public static InputStream encrypt(InputStream dataToEncrypt, char[] key) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Encrypt data with parameters, initial vector is default zero- Parameters:
dataToEncrypt- data to encryptkey- encrypting key- Returns:
- encrypted data in InputStream
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
encrypt
public static byte[] encrypt(byte[] dataToEncrypt, char[] key, String initVector) throws hu.icellmobilsoft.coffee.dto.exception.BaseExceptionEncrypt data with parameters- Parameters:
dataToEncrypt- data to encryptkey- encrypting keyinitVector- initial vector- Returns:
- encrypted data in byte[]
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
encrypt
public static InputStream encrypt(InputStream dataToEncrypt, char[] key, String initVector) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Encrypt data with parameters- Parameters:
dataToEncrypt- data to encryptkey- encrypting keyinitVector- initial vector- Returns:
- encrypted data in InputStream
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
decrypt
public static byte[] decrypt(byte[] encryptedData, char[] key) throws hu.icellmobilsoft.coffee.dto.exception.BaseExceptionDecrypt data with parameters, initial vector is default zero- Parameters:
encryptedData- encrypted datakey- decrypting key- Returns:
- decrypted data in byte[]
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
decrypt
public static InputStream decrypt(InputStream encryptedData, char[] key) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Decrypt data with parameters, initial vector is default zero- Parameters:
encryptedData- encrypted datakey- decrypting key- Returns:
- decrypted data in InputStream
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
decrypt
public static byte[] decrypt(byte[] encryptedData, char[] key, String initVector) throws hu.icellmobilsoft.coffee.dto.exception.BaseExceptionDecrypt data with parameters- Parameters:
encryptedData- encrypted datakey- decrypting keyinitVector- initial vector- Returns:
- decrypted data in byte[]
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
decrypt
public static InputStream decrypt(InputStream encryptedData, char[] key, String initVector) throws hu.icellmobilsoft.coffee.dto.exception.BaseException
Decrypt data with parameters- Parameters:
encryptedData- encrypted datakey- decrypting keyinitVector- initial vector- Returns:
- decrypted data in InputStream
- Throws:
hu.icellmobilsoft.coffee.dto.exception.BaseException- if any error
-
-