Browse Source

fix den bug

master
独行之狼 4 years ago
parent
commit
523625ae1d
  1. BIN
      fr-plugin-DataEncryptor-1.0/fr-plugin-DataEncryptor-1.0.jar
  2. BIN
      install/fr-plugin-DataEncryptor-1.0.zip
  3. 8
      src/com/fr/plugin/data/encrypt/FunConstants.java

BIN
fr-plugin-DataEncryptor-1.0/fr-plugin-DataEncryptor-1.0.jar

Binary file not shown.

BIN
install/fr-plugin-DataEncryptor-1.0.zip

Binary file not shown.

8
src/com/fr/plugin/data/encrypt/FunConstants.java

@ -78,7 +78,7 @@ public class FunConstants {
} }
} }
final static SimpleStringPBEConfig getSimpleStringPBEConfig(String secretKey,String algorithm) { final static SimpleStringPBEConfig GetSimpleStringPBEConfig(String secretKey, String algorithm) {
SimpleStringPBEConfig config = new SimpleStringPBEConfig(); SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword(secretKey); config.setPassword(secretKey);
config.setPoolSize("1"); config.setPoolSize("1");
@ -86,15 +86,15 @@ public class FunConstants {
config.setAlgorithm(algorithm); config.setAlgorithm(algorithm);
config.setKeyObtentionIterations("1000"); config.setKeyObtentionIterations("1000");
config.setProviderName("SunJCE"); config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); // config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
config.setStringOutputType("base64"); config.setStringOutputType("base64");
return config; return config;
} }
final static String EncryptData(String secretKey, String message,String algorithm, boolean isEncrypt){ final static String EncryptData(String secretKey, String message,String algorithm, boolean isEncrypt){
PooledPBEStringEncryptor pooledPBEStringEncryptor = new PooledPBEStringEncryptor(); PooledPBEStringEncryptor pooledPBEStringEncryptor = new PooledPBEStringEncryptor();
pooledPBEStringEncryptor.setConfig(getSimpleStringPBEConfig(secretKey,algorithm)); pooledPBEStringEncryptor.setConfig(GetSimpleStringPBEConfig(secretKey,algorithm));
String result = isEncrypt ? pooledPBEStringEncryptor.encrypt(message) : pooledPBEStringEncryptor.decrypt(message); String result = isEncrypt ? pooledPBEStringEncryptor.encrypt(message) : pooledPBEStringEncryptor.decrypt(message);
return result; return result;
} }

Loading…
Cancel
Save