deriveKey derives a device key
(key types.AES128Key, t byte, devEUI types.EUI64)
| 81 | |
| 82 | // deriveKey derives a device key |
| 83 | func 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 |
| 93 | func DeriveJSIntKey(key types.AES128Key, devEUI types.EUI64) types.AES128Key { |
no test coverage detected