Skip to content

Commit efc1db0

Browse files
author
Ricky
committed
- Updated README files
- Updated toml file - Created .in file
1 parent 5362a79 commit efc1db0

File tree

4 files changed

+141
-1
lines changed

4 files changed

+141
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# dlms-encrypt-decrypt-tool
1+
# dlms-encrypt-decrypt-tool
2+
3+
## Supported language
4+
5+
| Language | Directory | Build tool |
6+
|------------|-----------|----------------|
7+
| Python | `python/` | setuptools |
8+
| Node.js | `js/` | npm |
9+
| C# | `csharp/` | .NET CLI |
10+
| Java | `java/` | Maven |
11+
| C++ | `cpp/` | CMake |
12+
| Rust | `rust/` | Cargo |
13+
14+
### 📦 How to use
15+
16+
Each directory has its own README file

python/MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.md
2+
include LICENSE

python/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# 🛡️ DLMS Crypto Tool
2+
3+
**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.
4+
5+
## ✨ Features
6+
7+
- **🔒 Encryption:** Encrypts DLMS APDU messages.
8+
- **🔑 Decryption:** Decrypts APDU messages.
9+
- **🧾 Authentication:** Generates authentication tags.
10+
- **💻 CLI Interface:** Use command-line options to perform encryption, decryption, authentication, and key generation.
11+
- **📁 File I/O Support:** Optionally load input data from files and output results to files.
12+
- **📝 Verbose Mode:** Provides detailed logging for debugging and traceability.
13+
- **📚 Documentation:** Detailed docs generated using MkDocs to guide you through using the tool.
14+
15+
## 🚀 Requirements
16+
17+
- Python 3.6 or higher
18+
- [cryptography](https://pypi.org/project/cryptography/)
19+
20+
## 📦 Installation
21+
22+
Install **DLMS Crypto Tool** from PyPI using pip:
23+
24+
```
25+
pip install dlms_crypto_tool
26+
```
27+
28+
Alternatively, clone the repository and install locally:
29+
30+
```
31+
git clone https://github.com/ric-geek/dlms-encrypt-decrypt-tool.git
32+
cd dlmscrypto
33+
pip install .
34+
```
35+
36+
## How to use it
37+
38+
The package exposes a CLI command called `dlmscli` for easy interaction.
39+
40+
🔑 Generate a Random Encryption Key
41+
42+
```
43+
dlmscli -k
44+
```
45+
46+
🔐 Encrypt an APDU Message
47+
48+
System Title = 5249435249435249\
49+
Frame Counter = 80000001\
50+
Encryption Key = 454E4352595054494F4E4B45594B4559\
51+
Authentication Key = 41555448454E5449434154494F4E4B45\
52+
APDU = c001810001000060010aff0200
53+
54+
```
55+
dlmscli -e 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
56+
```
57+
Result
58+
```
59+
Encrypted/Decrypted APDU: 0de63f2331a09aa85e8830f5f3
60+
```
61+
62+
🔓 Decrypt an APDU Message
63+
64+
System Title = 5249435249435249\
65+
Frame Counter = 80000001\
66+
Encryption Key = 454E4352595054494F4E4B45594B4559\
67+
Authentication Key = 41555448454E5449434154494F4E4B45\
68+
APDU = 0de63f2331a09aa85e8830f5f3
69+
70+
```
71+
dlmscli -d 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
72+
```
73+
Result
74+
```
75+
Encrypted/Decrypted APDU: c001810001000060010aff0200
76+
```
77+
78+
🔎 Authenticate an APDU Message
79+
80+
System Title = 5249435249435249\
81+
Frame Counter = 00000001\
82+
Encryption Key = 454E4352595054494F4E4B45594B4559\
83+
Authentication Key = 41555448454E5449434154494F4E4B45\
84+
APDU = 0de63f2331a09aa85e8830f5f3
85+
```
86+
dlmscli -a 5249435249435249 00000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
87+
```
88+
Result
89+
```
90+
TAG: 62d423292e0fe5320370881d
91+
```
92+
93+
## 📜 License
94+
95+
This project is licensed under the ### GNU General Public License v3.0
96+
97+
## 🙏 Acknowledgments
98+
99+
Special thanks to the [cryptography](https://github.com/pyca/cryptography) team for providing an excellent library.
100+
101+
102+
103+

python/pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "dlms_crypto_tool"
7+
version = "0.0.1"
8+
description = "A tool for encrypting, decrypting, and authenticating DLMS APDU messages."
9+
readme = "README.md"
10+
license = { file = "LICENSE" }
11+
authors = [
12+
{ name = "ricgeek", email = "solidkind@gmail.com" }
13+
]
14+
requires-python = ">=3.6"
15+
dependencies = [
16+
"cryptography"
17+
]
18+
19+
[project.scripts]
20+
dlmscli = "dlms_crypto_tool.cli:main"

0 commit comments

Comments
 (0)