Security Check. bad token
De informatie lijkt aardig verspreid, ik heb al veel verschillende variaties geprobeerd met de tijd en key.
Ik krijg al wel dezelfde output als in dit voorbeeld voor downlink:
https://zakelijkforum.kpn.com/lora-forum-16/uplink-and-downlink-messages-signed-with-sha-tokens-8313
Een stukje Java, hoe ik het nu probeer:
code:
String devId = "00112233";
String fPort = "4";
String payload = "00000AABBCC112233";
String route = "1";
String lrcKey = "AA11".toLowerCase();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
String timeStr = df.format(new Date());
String queryString = "DevEUI=" + devId + "&FPort=" + fPort + "&Payload="
+ payload + "&AS_ID=" + route + "&Time=" + timeStr;
String combined = queryString + lrcKey;
String actilityUrl = "https://api.kpn-lora.com/thingpark/lrc/rest/downlink";
try {
postConnect(actilityUrl + "?" + queryString + "&Token=" + sha256(combined));
} catch (IOException ex) {
System.err.println("postConnect: " + Log.stackTrace(ex));
}
Dit geeft het volgende HTTP request:
code:
POST /thingpark/lrc/rest/downlink?DevEUI=00112233&FPort=4&Payload=00000AABBCC112233&AS_ID=1&Time=2017-04-12T09:27:32Z&Token=cafb7803dba92ce0e647b025385016fa955139937fd01e7b00f1b47c69fea8f3 HTTP/1.1
charset: utf-8
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.8.0_60
Host: localhost:8088
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
Content-Length: 0
Misschien gebruik ik de vekeerde key. Ik gebruik nu de LRC-AS key van de application server, zonder '-', en omgezet naar lowercase. Of doe ik nog wat anders fout?