类 CryptoUtils
java.lang.Object
cool.scx.common.util.CryptoUtils
加密,解密工具类
- 版本:
- 0.0.1
- 作者:
- scx567888
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static 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) 使用自定义的密码 , 加密字符串
-
构造器详细资料
-
CryptoUtils
public CryptoUtils()
-
-
方法详细资料
-
encryptText
使用自定义的密码 , 加密字符串- 参数:
text- 待加密的字符串encryptorPassword- 自定义的密码- 返回:
- a 密文
-
decryptText
使用自定义的密码 , 解密字符串- 参数:
text- 密文encryptorPassword- 自定义的密码- 返回:
- a 结果
-
encryptBinary
使用自定义的密码 , 加密- 参数:
binary- 待加密的字符串encryptorPassword- 自定义的密码- 返回:
- a 密文
-
decryptBinary
使用自定义的密码 , 解密- 参数:
encryptedBinary- 密文encryptorPassword- 自定义的密码- 返回:
- a 结果
-
encryptPassword
加密密码- 参数:
password- p- 返回:
- p
-
checkPassword
校验密码- 参数:
plainPassword- 原密码encryptedPassword- 加密后的密码- 返回:
- a
-
encrypt
public static byte[] encrypt(String algorithm, byte[] password, byte[] data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException 加密- 参数:
algorithm- 算法password- 密码data- 数据- 返回:
- 加密后的数据
- 抛出:
NoSuchAlgorithmException- aNoSuchPaddingException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- a
-
decrypt
public static byte[] decrypt(String algorithm, byte[] password, byte[] data) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException 解密- 参数:
algorithm- 算法password- 密码data- 密文- 返回:
- 解密后的数据
- 抛出:
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 加密- 参数:
algorithm- 算法params- 算法参数password- 密码data- 数据- 返回:
- 加密后的数据
- 抛出:
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 解密- 参数:
algorithm- 算法params- 算法参数password- 密码data- 密文- 返回:
- 解密后的数据
- 抛出:
NoSuchPaddingException- aNoSuchAlgorithmException- aInvalidKeyException- aIllegalBlockSizeException- aBadPaddingException- aInvalidAlgorithmParameterException- a
-