WANG 6 éve
szülő
commit
ddede3184d

+ 2 - 2
src/main/java/cn/com/qmth/examcloud/web/bootstrap/BootstrapSecurityUtil.java

@@ -57,7 +57,6 @@ public class BootstrapSecurityUtil {
 	 * @param secretKey
 	 */
 	public static void decrypt(Properties props, String secretKey) {
-		AES aes = new AES(secretKey + RANDOM);
 		Map<String, String> map = Maps.newHashMap();
 		Set<String> set = Sets.newHashSet();
 		for (Entry<Object, Object> entry : props.entrySet()) {
@@ -65,6 +64,7 @@ public class BootstrapSecurityUtil {
 			Object value = entry.getValue();
 			if (key instanceof String && value instanceof String) {
 				if (((String) key).startsWith(ENCRYPTED_HEAD)) {
+					AES aes = new AES(secretKey + RANDOM);
 					String decryptedValue = aes.decrypt((String) value);
 					String newKey = ((String) key).substring(ENCRYPTED_HEAD.length());
 					map.put(newKey, decryptedValue);
@@ -90,13 +90,13 @@ public class BootstrapSecurityUtil {
 	 * @param secretKey
 	 */
 	public static void decrypt(Map<String, String> props, String secretKey) {
-		AES aes = new AES(secretKey + RANDOM);
 		Map<String, String> map = Maps.newHashMap();
 		Set<String> set = Sets.newHashSet();
 		for (Entry<String, String> entry : props.entrySet()) {
 			String key = entry.getKey();
 			String value = entry.getValue();
 			if (key.startsWith(ENCRYPTED_HEAD)) {
+				AES aes = new AES(secretKey + RANDOM);
 				String decrypted = aes.decrypt((String) value);
 				map.put(key.substring(ENCRYPTED_HEAD.length() + 1), decrypted);
 				set.add(key);