Commit eaadb1f3 by 罗胜

2024-09-25

硬编码秘钥处理
parent e630033e
......@@ -24,7 +24,7 @@ import java.util.Properties;
public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
// private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839";
private static final String CONF_DESC_KEY = "9103efb684eb53b3951bb641ef0f353a74d52a439eb4fc90eb507db1d17b81321e10a31633d2fc3c547c3834f4143d1af11e8ac13aa32ae966e94d7ac1a1a33e";
// private static final String CONF_DESC_KEY = "9103efb684eb53b3951bb641ef0f353a74d52a439eb4fc90eb507db1d17b81321e10a31633d2fc3c547c3834f4143d1af11e8ac13aa32ae966e94d7ac1a1a33e";
private static byte[] KEY_BYTE =new byte[]{43, -113, 127, 14, -39, 99, -3, -26, 50, 31, -98, -61, -46, 61, 56, 120};
......@@ -32,25 +32,25 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException {
// TODO Auto-generated method stub
try {
Enumeration<?> enu = props.propertyNames();
while (enu.hasMoreElements()) {
try {
String key = (String) enu.nextElement();
String val = (String) props.get(key);
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, KEY_BYTE);
String key1 = aes.decryptStr(CONF_DESC_KEY, CharsetUtil.CHARSET_UTF_8);
String decorded = DES3Utils.decrypt(val, key1);
if (decorded != null) {
props.put(key, decorded);
}
} catch (Exception e) {
// TODO: handle exception
}
}
} catch (Exception e) {
// TODO: handle exception
}
// try {
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// try {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, KEY_BYTE);
// String key1 = aes.decryptStr(CONF_DESC_KEY, CharsetUtil.CHARSET_UTF_8);
// String decorded = DES3Utils.decrypt(val, key1);
// if (decorded != null) {
// props.put(key, decorded);
// }
// } catch (Exception e) {
// // TODO: handle exception
// }
// }
// } catch (Exception e) {
// // TODO: handle exception
// }
super.processProperties(beanFactory, props);
}
......@@ -87,6 +87,6 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
}
public static void main(String[] args) {
System.out.println(DES3Utils.decrypt("f5c9d35c1df1eb31c0f15d23ee5af33d15ee14d1133b16ae580893ec603fc77c0057d3cccb34407d0505fc99a849cd7ee060d2c605d68b21ea7fea2a325dd4026e7f13e65e216d967bc7696f608fe56ef11ae4801b727c51d09bc4beb44b24f0", CONF_DESC_KEY));
// System.out.println(DES3Utils.decrypt("f5c9d35c1df1eb31c0f15d23ee5af33d15ee14d1133b16ae580893ec603fc77c0057d3cccb34407d0505fc99a849cd7ee060d2c605d68b21ea7fea2a325dd4026e7f13e65e216d967bc7696f608fe56ef11ae4801b727c51d09bc4beb44b24f0", CONF_DESC_KEY));
}
}
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