| 
 | 
 | 
# AVL AES Key Handling
 | 
| 
 | 
 | 
 | 
| 
 | 
 | 
```mermaid
 | 
| 
 | 
 | 
 | 
| 
 | 
 | 
sequenceDiagram
 | 
| 
 | 
 | 
	 
 | 
| 
 | 
 | 
	autonumber
 | 
| 
 | 
 | 
	... create D2Sphere TCP conncetion ...
 | 
| 
 | 
 | 
	Dev -> Dev_TCP : create TCP session
 | 
| 
 | 
 | 
	Dev_TCP -> D2S_TCP : sent Login plain (contains uuid/IMEI and used enryption mode)
 | 
| 
 | 
 | 
	Dev_TCP <- Dev : 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
 | 
| 
 | 
 | 
	Dev_TCP <- D2S_DB : load AES key for uuid
 | 
| 
 | 
 | 
	D2S_TCP <- D2S_TCP : start using enryption
 | 
| 
 | 
 | 
	Dev_TCP <-> D2S_TCP : excahnge data
 | 
| 
 | 
 | 
	Dev_TCP <-> D2S_TCP : excahnge data
 | 
| 
 | 
 | 
	
 | 
| 
 | 
 | 
	... key change via REST API ...
 | 
| 
 | 
 | 
	Dev_TCP <-> D2S_TCP : excahnge data
 | 
| 
 | 
 | 
	Dev_TCP <-> D2S_TCP : excahnge data
 | 
| 
 | 
 | 
	D2S_TCP <- D2S_API: keychange request with new key
 | 
| 
 | 
 | 
	Dev_TCP <- D2S_TCP : sent new Key
 | 
| 
 | 
 | 
	Dev <- Dev_TCP : store new key in TPM key store
 | 
| 
 | 
 | 
	D2S_TCP <- Dev_TCP : sent ACK / OK:ERROR
 | 
| 
 | 
 | 
	Dev_TCP <- Dev_TCP : use new Key
 | 
| 
 | 
 | 
	D2S_TCP <- D2S_TCP : receive ACK / OK
 | 
| 
 | 
 | 
	D2S_DB <- D2S_TCP : 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
 | 
| 
 | 
 | 
``` | 
 | 
 | 
\ No newline at end of file |