try {
/* Check whether the length of the decryptData is NOT multiplies of 16 */
if ((decodedB64.length & 0xF) != 0) {
+ logger.debug("Length of message is {}.", decodedB64.length);
/* Return the data */
retString = new String(decodedB64, remoteDevice.getCharSet());
- logger.debug("Did NOT decrypt message");
+ logger.debug("Did NOT decrypt message, returning {}.", retString);
return retString;
}
// --- create cipher
byte[] decryptedDataWOZP = removeZeroPadding(decryptedData);
return (new String(decryptedDataWOZP, remoteDevice.getCharSet()));
} catch (UnsupportedEncodingException | GeneralSecurityException e) {
- logger.warn("Exception on encoding", e);
+ logger.warn("Exception on encoding ({})", e.getMessage());
return null;
}
}
logger.debug("Base64encoding not possible: {}", e.getMessage());
}
} catch (UnsupportedEncodingException | GeneralSecurityException e) {
- logger.warn("Exception on encoding", e);
+ logger.warn("Exception on encoding ({})", e.getMessage());
}
return null;
}
public KM200Device(HttpClient httpClient) {
serviceTreeMap = new HashMap<>();
getBlacklistMap().add("/gateway/firmware");
+ getBlacklistMap().add("/gateway/registrations");
virtualList = new ArrayList<>();
comCryption = new KM200Cryption(this);
deviceCommunicator = new KM200Comm<>(this, httpClient);
public @Nullable JsonObject getServiceNode(String service) {
String decodedData = null;
JsonObject nodeRoot = null;
+ logger.debug("{}: trying to query information.", service);
byte[] recData = deviceCommunicator.getDataFromService(service.toString());
try {
if (recData == null) {
decodedData = "";
return nodeRoot;
} else {
+ logger.debug("{}: trying to decode: {}.", service, recData.toString());
decodedData = comCryption.decodeMessage(recData);
if (decodedData == null) {
logger.warn("Decoding of the KM200 message is not possible!");
}
if (decodedData.length() > 0) {
if ("SERVICE NOT AVAILABLE".equals(decodedData)) {
- logger.debug("{}: SERVICE NOT AVAILABLE", service);
+ logger.warn("{}: SERVICE NOT AVAILABLE", service);
return null;
} else {
+ logger.debug("{}: trying to parse {}", service, decodedData.toString());
nodeRoot = (JsonObject) JsonParser.parseString(decodedData);
}
} else {