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

Function deriveDeviceKey

pkg/crypto/key_derivation.go:83–90  ·  view source on GitHub ↗

deriveKey derives a device key

(key types.AES128Key, t byte, devEUI types.EUI64)

Source from the content-addressed store, hash-verified

81
82// deriveKey derives a device key
83func deriveDeviceKey(key types.AES128Key, t byte, devEUI types.EUI64) (derived types.AES128Key) {
84 buf := make([]byte, 16)
85 buf[0] = t
86 copy(buf[1:9], reverse(devEUI[:]))
87 block, _ := aes.NewCipher(key[:])
88 block.Encrypt(derived[:], buf)
89 return
90}
91
92// DeriveJSIntKey derives the Join Server Integrity Key
93func DeriveJSIntKey(key types.AES128Key, devEUI types.EUI64) types.AES128Key {

Callers 2

DeriveJSIntKeyFunction · 0.85
DeriveJSEncKeyFunction · 0.85

Calls 2

reverseFunction · 0.85
EncryptMethod · 0.65

Tested by

no test coverage detected