22 lines
495 B
Java
22 lines
495 B
Java
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.PKCS5Padding,
|
|
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);
|
|
}
|
|
}
|