https://github.com/ric-geek/dlms-encrypt-decrypt-cli
Simple CLI for decrypting and encripting DLMS APDU
https://github.com/ric-geek/dlms-encrypt-decrypt-cli
cli cosem dlms encryption-decryption gas-meter python3 smart-metering smartmeter
Last synced: 10 months ago
JSON representation
Simple CLI for decrypting and encripting DLMS APDU
- Host: GitHub
- URL: https://github.com/ric-geek/dlms-encrypt-decrypt-cli
- Owner: ric-geek
- License: mit
- Created: 2020-06-14T19:21:18.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-11T18:56:36.000Z (about 1 year ago)
- Last Synced: 2025-04-13T09:19:21.252Z (about 1 year ago)
- Topics: cli, cosem, dlms, encryption-decryption, gas-meter, python3, smart-metering, smartmeter
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dlms encrypt-decrypt command line tool
With this tool you can perform these operation:
- Generate encrypted APDU
- Decrypt APDU
- Authenticate APDU
- Generate encryption key
## Installation
Use pip:
```
pip install setup.py
```
Use pypi:
```
pip install dlms-cli
```
## Usage
### Encrypt
**Example**\
System Title = 5249435249435249\
Frame Counter = 80000001\
Encryption Key = 454E4352595054494F4E4B45594B4559\
Authentication Key = 41555448454E5449434154494F4E4B45\
APDU = c001810001000060010aff0200
```
dlms_cli -e 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
```
Result
```
Encrypted/Decrypted APDU: 0de63f2331a09aa85e8830f5f3
Authentication TAG: 610d47e1e24b14e8a022aefc6a43f3a3
```
### Decrypt
**Example**\
System Title = 5249435249435249\
Frame Counter = 80000001\
Encryption Key = 454E4352595054494F4E4B45594B4559\
Authentication Key = 41555448454E5449434154494F4E4B45\
APDU = 0de63f2331a09aa85e8830f5f3
```
dlms_cli -d 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
```
Result
```
Encrypted/Decrypted APDU: c001810001000060010aff0200
Authentication TAG: 977d4d21b7255a1b681fe6b1c902a7dc
```
### Generate authenticated data
**Example**\
System Title = 5249435249435249\
Frame Counter = 00000001\
Encryption Key = 454E4352595054494F4E4B45594B4559\
Authentication Key = 41555448454E5449434154494F4E4B45\
APDU = 0de63f2331a09aa85e8830f5f3
```
dlms_cli -a 5249435249435249 00000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
```
Result
```
TAG: 62d423292e0fe5320370881d
```
### Generate encryption key
**Example**
```
dlms_cli -k
```
Result
```
Encryption Key: 08f418ad55d89f38388a7e379b16353f
```
### Generate encryption key and store it in a txt ile
**Example**
```
dlms_cli --onfile "path_where_you_want_save_file\file_name.txt
```
### How to use with the executable
**Example**
```
dlms_cli.exe -e 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
```
## Dependency
[cryptography](https://github.com/pyca/cryptography)
## License
MIT