AVL AES Key Handling
sequenceDiagram
participant Dev as "Device"
participant Dev_TCP as "Device TCP Session"
participant D2S_TCP as "D2Sphere TCP Session"
participant D2S_DB as "D2Sphere Database"
participant D2S_API as "D2SPhere REST API"
%%Note over Dev,Dev_TCP,D2S_TCP,D2S_DB,D2S_API: create D2Sphere TCP conncetion
autonumber
Dev->>Dev_TCP: create TCP session
Dev_TCP->>D2S_TCP: sent Login plain (contains uuid/IMEI and used enryption mode)
Dev->>Dev_TCP : load AES key from TPM key store to AES module
Dev_TCP->> Dev_TCP : start using enryption
Dev_TCP->>Dev_TCP : parse Login, mode, uuid
D2S_DB->>Dev_TCP : load AES key for uuid
D2S_TCP->>D2S_TCP : start using enryption
Dev_TCP->D2S_TCP: excahnge data
Dev_TCP->D2S_TCP: excahnge data
%%Note over Dev,Dev_TCP,D2S_TCP,D2S_DB,D2S_API: key change via REST API
Dev_TCP->D2S_TCP : excahnge data
Dev_TCP->D2S_TCP : excahnge data
D2S_API->>D2S_TCP: keychange request with new key
D2S_TCP->Dev_TCP : sent new Key
Dev_TCP->>Dev : store new key in TPM key store
Dev_TCP->>D2S_TCP : sent ACK / OK:ERROR
Dev_TCP->Dev_TCP : use new Key
D2S_TCP->D2S_TCP : receive ACK / OK
D2S_TCP->>D2S_DB : store new Key
D2S_TCP->>D2S_API : respond API request
D2S_TCP->D2S_TCP : use new key
Dev_TCP->>D2S_TCP : excahnge data with new Key
Dev_TCP->>D2S_TCP : excahnge data with new Key