Skip to content

Commit 4bab015

Browse files
Ricky Ubuntu 24.04Ricky Ubuntu 24.04
authored andcommitted
Added cpp project
1 parent e4df58e commit 4bab015

File tree

18 files changed

+2896
-2896
lines changed

18 files changed

+2896
-2896
lines changed

.gitignore

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Ignore files with this exstension
2-
*.pyc
3-
*.bak
4-
5-
idea/
6-
__pycache__/
7-
8-
# JetBrains IDE
9-
.idea/
10-
1+
# Ignore files with this exstension
2+
*.pyc
3+
*.bak
4+
5+
idea/
6+
__pycache__/
7+
8+
# JetBrains IDE
9+
.idea/
10+
1111
node_modules/

LICENSE

Lines changed: 674 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
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
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

cpp/dlms_crypto_tool/README.md

Whitespace-only changes.

cpp/dlms_crypto_tool/src/dlms_crypto_tool.cpp

Whitespace-only changes.

cpp/dlms_crypto_tool/src/dlms_crypto_tool.h

Whitespace-only changes.

js/README.md

Lines changed: 121 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,122 @@
1-
# 🛡️ DLMS Crypto Tool
2-
3-
**DLMS Crypto Tool** is a Node.js package and command-line interface (CLI) utility for encrypting, decrypting, generate encryption key, and authenticating DLMS APDU messages.
4-
5-
## ✨ Features
6-
7-
- **🔒 Encryption:** Encrypts DLMS APDU messages.
8-
- **🔑 Decryption:** Decrypts APDU messages.
9-
- **🧾 Authentication:** Generates authentication tags.
10-
- **💻 CLI Interface:** Interact with the tool via a command‑line utility (`dlmscli`).
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-
- **✅ Well-Tested:** Unit tests are provided with Mocha to ensure core functionality.
14-
15-
## 🚀 Requirements
16-
17-
- Node.js vs23.11.0 (tested only with this version)
18-
- [Commander](https://www.npmjs.com/package/commander)
19-
- [Mocha](https://mochajs.org/) if you want run Unit tests
20-
- npm (comes with Node.js)
21-
22-
## 📦 Installation
23-
24-
You can install the package globally from npm to get the CLI:
25-
26-
```
27-
npm install -g dlms_crypto_tool
28-
```
29-
30-
Or install it as a dependecy in your project:
31-
32-
```
33-
npm install dlms_crypto_tool
34-
```
35-
36-
## How to use it
37-
38-
The package provide a CLI command called `dlmscli`.
39-
40-
🔑 Generate a Random Encryption Key
41-
42-
```
43-
dlmscli key
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 encrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
56-
```
57-
*Tip:* Use --infile <path> to load input from a file and --outfile <path> to save the output
58-
59-
🔓 Decrypt an APDU Message
60-
61-
System Title = 5249435249435249\
62-
Frame Counter = 80000001\
63-
Encryption Key = 454E4352595054494F4E4B45594B4559\
64-
Authentication Key = 41555448454E5449434154494F4E4B45\
65-
APDU = 0de63f2331a09aa85e8830f5f3
66-
67-
```
68-
dlmscli decrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
69-
```
70-
Result
71-
```
72-
Encrypted/Decrypted APDU: c001810001000060010aff0200
73-
```
74-
75-
🔎 Authenticate an APDU Message
76-
77-
System Title = 5249435249435249\
78-
Frame Counter = 00000001\
79-
Encryption Key = 454E4352595054494F4E4B45594B4559\
80-
Authentication Key = 41555448454E5449434154494F4E4B45\
81-
APDU = 0de63f2331a09aa85e8830f5f3
82-
```
83-
dlmscli auth 5249435249435249 00000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
84-
```
85-
Result
86-
```
87-
TAG: 62d423292e0fe5320370881d
88-
```
89-
90-
## 🧪 Running Tests
91-
92-
To run unit test using Mocha, follow these steps:
93-
94-
1. Clone the repository and install the development dependencies:
95-
96-
```
97-
git clone https://github.com/YourUsername/dlms-crypto-tool.git
98-
cd dlms-crypto-tool
99-
npm install
100-
```
101-
2. Run tests:
102-
103-
```
104-
105-
npm test
106-
```
107-
108-
## 🤝 Contributing
109-
110-
Contributions are welcome! To contribute:
111-
112-
1. Fork the repository.
113-
114-
2. Create a new branch for your changes.
115-
116-
3. Write tests for your modifications.
117-
118-
4. Submit a pull request with a detailed explanation of your changes.
119-
120-
## 📜 License
121-
1+
# 🛡️ DLMS Crypto Tool
2+
3+
**DLMS Crypto Tool** is a Node.js package and command-line interface (CLI) utility for encrypting, decrypting, generate encryption key, and authenticating DLMS APDU messages.
4+
5+
## ✨ Features
6+
7+
- **🔒 Encryption:** Encrypts DLMS APDU messages.
8+
- **🔑 Decryption:** Decrypts APDU messages.
9+
- **🧾 Authentication:** Generates authentication tags.
10+
- **💻 CLI Interface:** Interact with the tool via a command‑line utility (`dlmscli`).
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+
- **✅ Well-Tested:** Unit tests are provided with Mocha to ensure core functionality.
14+
15+
## 🚀 Requirements
16+
17+
- Node.js vs23.11.0 (tested only with this version)
18+
- [Commander](https://www.npmjs.com/package/commander)
19+
- [Mocha](https://mochajs.org/) if you want run Unit tests
20+
- npm (comes with Node.js)
21+
22+
## 📦 Installation
23+
24+
You can install the package globally from npm to get the CLI:
25+
26+
```
27+
npm install -g dlms_crypto_tool
28+
```
29+
30+
Or install it as a dependecy in your project:
31+
32+
```
33+
npm install dlms_crypto_tool
34+
```
35+
36+
## How to use it
37+
38+
The package provide a CLI command called `dlmscli`.
39+
40+
🔑 Generate a Random Encryption Key
41+
42+
```
43+
dlmscli key
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 encrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 c001810001000060010aff0200
56+
```
57+
*Tip:* Use --infile <path> to load input from a file and --outfile <path> to save the output
58+
59+
🔓 Decrypt an APDU Message
60+
61+
System Title = 5249435249435249\
62+
Frame Counter = 80000001\
63+
Encryption Key = 454E4352595054494F4E4B45594B4559\
64+
Authentication Key = 41555448454E5449434154494F4E4B45\
65+
APDU = 0de63f2331a09aa85e8830f5f3
66+
67+
```
68+
dlmscli decrypt 5249435249435249 80000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
69+
```
70+
Result
71+
```
72+
Encrypted/Decrypted APDU: c001810001000060010aff0200
73+
```
74+
75+
🔎 Authenticate an APDU Message
76+
77+
System Title = 5249435249435249\
78+
Frame Counter = 00000001\
79+
Encryption Key = 454E4352595054494F4E4B45594B4559\
80+
Authentication Key = 41555448454E5449434154494F4E4B45\
81+
APDU = 0de63f2331a09aa85e8830f5f3
82+
```
83+
dlmscli auth 5249435249435249 00000001 454E4352595054494F4E4B45594B4559 41555448454E5449434154494F4E4B45 0de63f2331a09aa85e8830f5f3
84+
```
85+
Result
86+
```
87+
TAG: 62d423292e0fe5320370881d
88+
```
89+
90+
## 🧪 Running Tests
91+
92+
To run unit test using Mocha, follow these steps:
93+
94+
1. Clone the repository and install the development dependencies:
95+
96+
```
97+
git clone https://github.com/YourUsername/dlms-crypto-tool.git
98+
cd dlms-crypto-tool
99+
npm install
100+
```
101+
2. Run tests:
102+
103+
```
104+
105+
npm test
106+
```
107+
108+
## 🤝 Contributing
109+
110+
Contributions are welcome! To contribute:
111+
112+
1. Fork the repository.
113+
114+
2. Create a new branch for your changes.
115+
116+
3. Write tests for your modifications.
117+
118+
4. Submit a pull request with a detailed explanation of your changes.
119+
120+
## 📜 License
121+
122122
This project is licensed under the GNU General Public License v3.0

0 commit comments

Comments
 (0)