Update SecretUtils.java
This commit is contained in:
@@ -35,13 +35,13 @@ public class SecretUtils {
|
|||||||
public static String aesEncode(String word,String keyWord) {
|
public static String aesEncode(String word,String keyWord) {
|
||||||
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding,
|
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding,
|
||||||
new SecretKeySpec(keyWord.getBytes(), "AES"));
|
new SecretKeySpec(keyWord.getBytes(), "AES"));
|
||||||
return aes.encryptHex(word);
|
return aes.encryptBase64(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String aesDecode(String word,String keyWord) {
|
public static String aesDecode(String word,String keyWord) {
|
||||||
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding,
|
AES aes = new AES(Mode.ECB, Padding.PKCS5Padding,
|
||||||
new SecretKeySpec(keyWord.getBytes(), "AES"));
|
new SecretKeySpec(keyWord.getBytes(), "AES"));
|
||||||
return new String(aes.decrypt(HexUtil.decodeHex(word)));
|
return new String(aes.decrypt(Base64.decode(word)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user