}
}
}
}
else{
throw new InvalidEncryCredentialException();
}
//第1个字符串不为空
if(!StringUtils.isEmpty(items[0])){
//使用base64解码为源字符串。
byte[] data = Base64Coder.decryptBASE64(items[0]);
//查询键值。
Ki4soKey ki4soKey = keyService.findKeyByKeyId(encryCredentialInfo.getKeyId());
if(ki4soKey!=null){
//使用密钥进行解密。
byte[] origin = DESCoder.decrypt(data, ki4soKey.toSecurityKey());
//将byte数组转换为字符串。
String json = new String(origin);
@SuppressWarnings("rawtypes")
Map map = (Map)JSON.parse(json);
if(map!=null){
Object userId = map.get("userId");
Object createTime = map.get("createTime");
Object expiredTime = map.get("expiredTime");
encryCredentialInfo.setUserId(userId==null?null:userId.toString());
encryCredentialInfo.setCreateTime(createTime==null?null:new Date((Long.parseLong(createTime.toString()))));
encryCredentialInfo.setExpiredTime(expiredTime==null?null:new Date((Long.parseLong(expiredTime.toString()))));
}
}
}
else{
throw new InvalidEncryCredentialException();
}
}
else{
throw new InvalidEncryCredentialException();
}
}
catch (Exception e) {
LOGGER.log(Level.SEVERE, "parse encry credential exception", e);
throw new InvalidEncryCredentialException();
}
return encryCredentialInfo;
}