|
@@ -33,7 +33,10 @@ public class SecretKeyUtil {
|
|
KeyGenerator aes = KeyGenerator.getInstance("AES");
|
|
KeyGenerator aes = KeyGenerator.getInstance("AES");
|
|
//2.根据ecnodeRules规则初始化**生成器
|
|
//2.根据ecnodeRules规则初始化**生成器
|
|
//生成一个128位的随机源,根据传入的字节数组
|
|
//生成一个128位的随机源,根据传入的字节数组
|
|
- aes.init(128, new SecureRandom(encodeRules.getBytes()));
|
|
|
|
|
|
+// aes.init(128, new SecureRandom(encodeRules.getBytes()));
|
|
|
|
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
|
|
|
|
+ secureRandom.setSeed(encodeRules.getBytes());
|
|
|
|
+ aes.init(128, secureRandom);
|
|
//3.产生原始对称**
|
|
//3.产生原始对称**
|
|
SecretKey original_key = aes.generateKey();
|
|
SecretKey original_key = aes.generateKey();
|
|
//4.获得原始对称**的字节数组
|
|
//4.获得原始对称**的字节数组
|
|
@@ -75,7 +78,10 @@ public class SecretKeyUtil {
|
|
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
|
|
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
|
|
//2.根据ecnodeRules规则初始化**生成器
|
|
//2.根据ecnodeRules规则初始化**生成器
|
|
//生成一个128位的随机源,根据传入的字节数组
|
|
//生成一个128位的随机源,根据传入的字节数组
|
|
- keyGenerator.init(128, new SecureRandom(encodeRules.getBytes()));
|
|
|
|
|
|
+// keyGenerator.init(128, new SecureRandom(encodeRules.getBytes()));
|
|
|
|
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
|
|
|
|
+ secureRandom.setSeed(encodeRules.getBytes());
|
|
|
|
+ keyGenerator.init(128, secureRandom);
|
|
//3.产生原始对称**
|
|
//3.产生原始对称**
|
|
SecretKey original_key = keyGenerator.generateKey();
|
|
SecretKey original_key = keyGenerator.generateKey();
|
|
//4.获得原始对称**的字节数组
|
|
//4.获得原始对称**的字节数组
|