|
@@ -8,6 +8,7 @@ import java.util.Set;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Sets;
|
|
import com.google.common.collect.Sets;
|
|
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
import cn.com.qmth.examcloud.commons.util.AES;
|
|
import cn.com.qmth.examcloud.commons.util.AES;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -65,7 +66,13 @@ public class BootstrapSecurityUtil {
|
|
if (key instanceof String && value instanceof String) {
|
|
if (key instanceof String && value instanceof String) {
|
|
if (((String) key).startsWith(ENCRYPTED_HEAD)) {
|
|
if (((String) key).startsWith(ENCRYPTED_HEAD)) {
|
|
AES aes = new AES(secretKey + RANDOM);
|
|
AES aes = new AES(secretKey + RANDOM);
|
|
- String decryptedValue = aes.decrypt((String) value);
|
|
|
|
|
|
+ String decryptedValue = null;
|
|
|
|
+ try {
|
|
|
|
+ decryptedValue = aes.decrypt((String) value);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new ExamCloudRuntimeException(
|
|
|
|
+ "fail to decrypt value of '" + key + "'");
|
|
|
|
+ }
|
|
String newKey = ((String) key).substring(ENCRYPTED_HEAD.length());
|
|
String newKey = ((String) key).substring(ENCRYPTED_HEAD.length());
|
|
map.put(newKey, decryptedValue);
|
|
map.put(newKey, decryptedValue);
|
|
set.add((String) key);
|
|
set.add((String) key);
|