MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / DecryptDownlink

Function DecryptDownlink

pkg/crypto/data_messages.go:114–116  ·  view source on GitHub ↗

DecryptDownlink decrypts a downlink payload - The payload contains the FRMPayload bytes - For FPort>0, the AppSKey is used - For FPort=0, the NwkSEncKey/NwkSKey is used

(key types.AES128Key, addr types.DevAddr, fCnt uint32, payload []byte, opts ...EncryptionOption)

Source from the content-addressed store, hash-verified

112// - For FPort>0, the AppSKey is used
113// - For FPort=0, the NwkSEncKey/NwkSKey is used
114func DecryptDownlink(key types.AES128Key, addr types.DevAddr, fCnt uint32, payload []byte, opts ...EncryptionOption) ([]byte, error) {
115 return encryptMessage(key, 1, addr, fCnt, payload, opts...)
116}
117
118func computeMIC(key types.AES128Key, dir uint8, confFCnt uint16, addr types.DevAddr, fCnt uint32, payload []byte) ([4]byte, error) {
119 hash, _ := cmac.New(key[:])

Callers 4

decryptDownlinkMethod · 0.92
decodeDownlinkFunction · 0.92
processDownlinkFunction · 0.92

Calls 1

encryptMessageFunction · 0.85

Tested by 1