Class CryptoUtils
java.lang.Object
cool.scx.config.CryptoUtils
todo 这个类有存在的必要了吗?
加密,解密工具类
- Version:
- 0.0.1
- Author:
- scx567888
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckPassword(String plainPassword, String encryptedPassword) 校验密码static byte[]解密static byte[]decrypt(String algorithm, AlgorithmParameters params, byte[] password, byte[] data) 解密static byte[]decryptBinary(byte[] encryptedBinary, String encryptorPassword) 使用自定义的密码 , 解密static StringdecryptText(String text, String encryptorPassword) 使用自定义的密码 , 解密字符串static byte[]加密static byte[]encrypt(String algorithm, AlgorithmParameters params, byte[] password, byte[] data) 加密static byte[]encryptBinary(byte[] binary, String encryptorPassword) 使用自定义的密码 , 加密static StringencryptPassword(String password) 加密密码static StringencryptText(String text, String encryptorPassword) 使用自定义的密码 , 加密字符串
-
Constructor Details
-
CryptoUtils
public CryptoUtils()
-
-
Method Details
-
encryptText
-
decryptText
-
encryptBinary
使用自定义的密码 , 加密- Parameters:
binary- 待加密的字符串encryptorPassword- 自定义的密码- Returns:
- a 密文
-
decryptBinary
使用自定义的密码 , 解密- Parameters:
encryptedBinary- 密文encryptorPassword- 自定义的密码- Returns:
- a 结果
-
encryptPassword
-
checkPassword
-
encrypt
public static byte[] encrypt(String algorithm, byte[] password, byte[] data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException 加密- Parameters:
algorithm- 算法password- 密码data- 数据- Returns:
- 加密后的数据
- Throws:
NoSuchAlgorithmException- aNoSuchPaddingException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- a
-
decrypt
public static byte[] decrypt(String algorithm, byte[] password, byte[] data) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException 解密- Parameters:
algorithm- 算法password- 密码data- 密文- Returns:
- 解密后的数据
- Throws:
NoSuchPaddingException- aNoSuchAlgorithmException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- a
-
encrypt
public static byte[] encrypt(String algorithm, AlgorithmParameters params, byte[] password, byte[] data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException 加密- Parameters:
algorithm- 算法params- 算法参数password- 密码data- 数据- Returns:
- 加密后的数据
- Throws:
NoSuchAlgorithmException- aNoSuchPaddingException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- aInvalidAlgorithmParameterException- a
-
decrypt
public static byte[] decrypt(String algorithm, AlgorithmParameters params, byte[] password, byte[] data) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException 解密- Parameters:
algorithm- 算法params- 算法参数password- 密码data- 密文- Returns:
- 解密后的数据
- Throws:
NoSuchPaddingException- aNoSuchAlgorithmException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- aInvalidAlgorithmParameterException- a
-