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