A tool for encrypting, decrypting, and authenticating DLMS APDU messages.
Project description
🛡️ DLMS Crypto Tool
DLMS Crypto Tool is a Python package and command-line interface (CLI) utility for encrypting, decrypting, and authenticating DLMS APDU messages. It offers both a modular API for integration into your Python projects and a standalone CLI for quick operations.
✨ Features
- 🔒 Encryption: Encrypts DLMS APDU messages.
- 🔑 Decryption: Decrypts APDU messages.
- 🧾 Authentication: Generates authentication tags.
- 💻 CLI Interface: Use command-line options to perform encryption, decryption, authentication, and key generation.
- 📁 File I/O Support: Optionally load input data from files and output results to files.
- 📝 Verbose Mode: Provides detailed logging for debugging and traceability.
- 📚 Documentation: Detailed docs generated using MkDocs to guide you through using the tool.
🚀 Requirements
- Python 3.6 or higher
- cryptography
📦 Installation
Install DLMS Crypto Tool from PyPI using pip:
pip install dlms_crypto_tool
Alternatively, clone the repository and install locally:
git clone https://github.com/ric-geek/dlms-encrypt-decrypt-tool.git
cd dlmscrypto
pip install .
How to use it
The package exposes a CLI command called dlmscli for easy interaction.
🔑 Generate a Random Encryption Key
dlmscli key
🔐 Encrypt an APDU Message
System Title = 5249435249435249
Frame Counter = 80000001
Encryption Key = 454E4352595054494F4E4B45594B4559
Authentication Key = 41555448454E5449434154494F4E4B45
APDU = c001810001000060010aff0200
dlmscli encrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
Result
Encrypted/Decrypted APDU: 0de63f2331a09aa85e8830f5f3
🔓 Decrypt an APDU Message
System Title = 5249435249435249
Frame Counter = 80000001
Encryption Key = 454E4352595054494F4E4B45594B4559
Authentication Key = 41555448454E5449434154494F4E4B45
APDU = 0de63f2331a09aa85e8830f5f3
dlmscli decrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
Result
Encrypted/Decrypted APDU: c001810001000060010aff0200
🔎 Authenticate an APDU Message
System Title = 5249435249435249
Frame Counter = 00000001
Encryption Key = 454E4352595054494F4E4B45594B4559
Authentication Key = 41555448454E5449434154494F4E4B45
APDU = 0de63f2331a09aa85e8830f5f3
dlmscli auth 5249435249435249 00000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
Result
TAG: 62d423292e0fe5320370881d
Contributions are welcome! To contribute:
1. Fork the repository.
2. Create a new branch for your changes.
3. Write tests for your modifications.
4. Submit a pull request with a detailed explanation of your changes.
📜 License
This project is licensed under the GNU General Public License v3.0
🙏 Acknowledgments
Special thanks to the cryptography team for providing an excellent library.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dlms_crypto_tool-0.0.1.tar.gz.
File metadata
- Download URL: dlms_crypto_tool-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
719f0618f17dd046f09c031aa2a00711f8da2e2bfef6da0fa4aa04e8fbeb77aa
|
|
| MD5 |
1158751b7df7a25fe157f39294a62f37
|
|
| BLAKE2b-256 |
c5194d5c6332f0f54311506c06cdd3ea09c7b75add5788a79c50766843b29c63
|
File details
Details for the file dlms_crypto_tool-0.0.1-py3-none-any.whl.
File metadata
- Download URL: dlms_crypto_tool-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
030ef9e1c6cd3f48d92758c01b9bcec7ca50d2b97f7759d7aedb462ea79747c7
|
|
| MD5 |
602aee4a6548558878b37f2801e14689
|
|
| BLAKE2b-256 |
e12a9a79a817be574b0efb47337cff14575155666cb741166733c2d7ba10406a
|