LoRa Application Server that decrypts the payload and passes it to the provided Upstream HTTP server
539
This service is intended to be deployed on the Customer's side when using the "End-to-End Payload Encryption" feature (External Application Server).
It will decrypt the FRMPayload and pass it to configured the HTTP server (for decoding sensor data and futher processing).
Decryption is performed using the AppSKeyEncrypted field + the known KEK (Key Encryption Key).
Update example.env file to specify custom parameters and run the docker container like this:
docker run -p 8080:8080 --env-file ./test.env tektelicdocker/decrypting-application-server
Example of env file:
AS_KEK_LABEL=as-kek
AS_KEK=AAAAAAAAAAABBBBBBBBBBBBCCCCCCCCCC
UPSTREAM_HOST=http://localhost:8082
NS_HOST=https://lorawan-ns-na.tektelic.com
NS_BASE_PATH=/api/v2/integration/http/069ba6b3c2514e299ec23a8c0c23468c42f67af6aaa84c5e82f1d766027c34f3
Encrypted UL payload is delivered to this server in the format defined by Integration and Converter (described below)
Decrypted UL is delivered to the Upstream server in the POST request using the following format:
{
"decryptedHex": "AABBCCDDAABBCCDDAABBCCDDAABBCCDD",
"deviceEui": "647FDA0300004AAB",
"deviceName": "Device Name",
"deviceClass": "A",
"deviceModelId": "f8c1b0e0-da68-11ec-9f49-f7efa75f53dd",
"deviceModelName": "Tektelic Home Sensor",
"applicationId": "f8c1b0e0-da68-11ec-9f49-f7efa75f53dd",
"applicationName": "Application Name",
"fPort": 10,
"adrBit": true,
"ackBit": true,
"fCntUp": 142,
"fCntDown": 42,
"recvTime": 1345291148,
"devAddr": "076d51cf",
"confirmed": true,
"dataRate": 7,
"uLFreq": 866100000,
"margin": -32,
"battery": 20,
"devStatusTimeMillis": 1662382555000,
"rfRegion": "US902",
"gatewayCount": 1,
"gatewayRxInfo": [
{
"gwEui": "647FDAFFFE00CCCB",
"antennaId": 0,
"rssi": -100,
"snr": 9.5,
"lat": 123.0,
"lon": 123.0,
"alt": 10.0,
"gatewayName": "Gateway Name",
"channel": 0,
"codeRate": "4/5",
"crcStatus": 1,
"dataRate": {
"modulation": "LORA",
"spreadFactor": 10,
"bandwidth": 125
},
"gwTimeUtcMillis": 1558015672000,
"gwTimeGpsMillis": 1242050890000,
"rsig": null
}
]
}
decryptedHex - plaintext FRMPayload (decrypted by this server)
In order to send a DL to device, send the POST request in the following format:
POST /api/downlink
{
"deviceEui": "AABBCCDDAABBCCDD",
"confirmed": true,
"fPort": 10,
"payloadHex": "AABBCCDD",
"msgId": "123",
"fCntDown": 1,
"devAddr": "AABBCCDD",
"appSKey": "AABBCCDDAABBCCDDAABBCCDDAABBCCDD"
}
payloadHex - plain payload to be encrypted
Optional fields:
msgIdfCntDowndevAddrappSKeyCreate a Custom V2 converter with the following functions:
function decodeUplink(input) {
return {
"data": {
"bytes": input.bytes
},
"errors": [],
"warnings": [],
"tektelicMetadata": input.tektelicMetadata
};
}
function encodeDownlink(input) {
return {
"fPort": input.data.fPort,
"bytes": input.data.bytes,
"errors": [],
"warnings": []
};
}
To decrease the network traffic you can remove unnecessary fields from the tektelicMetadata object.
Create an HTTP V2 integration with the previously created Converter and the following parameters:
/api/uplinkSwagger available at /swagger-ui/
Content type
Image
Digest
sha256:f9fb13f33…
Size
336.3 MB
Last updated
about 1 year ago
docker pull tektelicdocker/decrypting-application-server