Commit d975baea authored by liqin's avatar liqin 💬

bug fixed

parent 449947fd
......@@ -16,6 +16,7 @@ import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
......@@ -47,7 +48,7 @@ public class PublicController extends BaseController {
// DES算法要求有一个可信任的随机数源
SecureRandom random = new SecureRandom();
// 创建一个DESKeySpec对象
DESKeySpec desKey = new DESKeySpec(key.getBytes("UTF-8"));
DESKeySpec desKey = new DESKeySpec(key.getBytes(StandardCharsets.UTF_8));
// 创建一个密匙工厂
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
// 将DESKeySpec对象转换成SecretKey对象
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment