服务检查时间是否一致

This commit is contained in:
heavyrian2012
2023-03-12 18:55:14 +08:00
parent 6a806aa10b
commit b7b262be00
3 changed files with 33 additions and 28 deletions
@@ -48,6 +48,9 @@ public enum ErrorCode {
ERROR_CODE_NOT_YOUR_LOCKED(26, "unload failure, not your lock"),
ERROR_CODE_ROBOT_NO_TOKEN(27, "robot no token"),
ERROR_CODE_WS_NOT_CONFIGURED_CORRECTLY(28, "ws not configured correctly"),
ERROR_CODE_TIME_INCONSISTENT(30, "time inconsistent"),
ERROR_CODE_CONFERENCE_ROOM_NOT_EXIST(60, "conference room not exist"),
ERROR_CODE_CONFERENCE_SERVICE_NOT_AVAILABLE(61, "conference service not available"),
@@ -107,15 +107,20 @@ public class AES {
}
return key;
}
public static byte[] AESDecrypt(byte[] sSrc, String userKey, boolean checkTime) {
return AESDecrypt(sSrc, userKey, checkTime, null);
}
public static byte[] AESDecrypt(byte[] sSrc, String userKey, boolean checkTime, boolean[] invalidTime) {
byte[] aesKey = aes_key;
if (userKey != null && !userKey.isEmpty()) {
aesKey = convertUserKey(userKey);
}
return AESDecrypt(sSrc, aesKey, checkTime);
return AESDecrypt(sSrc, aesKey, checkTime, invalidTime);
}
public static byte[] AESDecrypt(byte[] sSrc, byte[] aesKey, boolean checkTime) {
public static byte[] AESDecrypt(byte[] sSrc, byte[] aesKey, boolean checkTime, boolean[] invalidTime) {
try {
// 判断Key是否正确
@@ -152,6 +157,9 @@ public class AES {
int curhour = (int) ((System.currentTimeMillis()/1000 - 1514736000)/3600);
if (curhour - hours > 24 && checkTime) {
if(invalidTime != null) {
invalidTime[0] = true;
}
return null;
}
byte[] neworiginal = new byte[original.length - 4];