This commit is contained in:
Jesse-Ma
2022-12-13 16:23:54 +08:00
parent 5cb7ee80b8
commit 62d7ad4bf8
2 changed files with 31 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
package com.flagnote.note.utils;
import javax.crypto.spec.SecretKeySpec;
import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
public class SecretUtils {
private static AES aes = new AES(Mode.ECB, Padding.ZeroPadding,
new SecretKeySpec("b9t3pzbmybc66cba".getBytes(), "AES"));
public static byte[] encodeNote(byte[] text) {
return aes.encrypt(text);
}
public static byte[] decodeNote(byte[] text) {
return aes.decrypt(text);
}
}