Skip to content

Commit db15886

Browse files
committed
Update Readme
1 parent a0cd966 commit db15886

File tree

2 files changed

+175
-4
lines changed

2 files changed

+175
-4
lines changed

README.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,87 @@
11
# Easy Sign
22

3-
Simple C# Library for signing and verifying files.
3+
Easy Sign is a simple C# library for signing and verifying files. It supports multiple .NET targets, including .NET Standard 2.1, .NET 6, and .NET 8.
4+
5+
## Features
6+
7+
- Sign files with X.509 certificates.
8+
- Verify file integrity and signatures.
9+
- Store files within the bundle.
10+
- Support for concurrent operations.
11+
12+
## Installation
13+
14+
To install Easy Sign, run the following command:
15+
16+
17+
```
18+
dotnet add package SAPTeam.EasySign
19+
20+
```
21+
22+
## Usage
23+
24+
### Creating a Bundle
25+
26+
27+
```
28+
using SAPTeam.EasySign;
29+
30+
// Initialize a new bundle
31+
var bundle = new Bundle("path/to/dir");
32+
33+
// Add files to the bundle
34+
bundle.AddEntry("path/to/dir/file1.txt");
35+
bundle.AddEntry("path/to/dir/file2.txt");
36+
37+
// Sign the bundle
38+
var certificate = new X509Certificate2("path/to/certificate.pfx", "password");
39+
var privateKey = certificate.GetRSAPrivateKey();
40+
bundle.Sign(certificate, privateKey);
41+
42+
// Save the bundle
43+
bundle.Update();
44+
45+
```
46+
47+
### Loading and Verifying a Bundle
48+
49+
50+
```
51+
using SAPTeam.EasySign;
52+
53+
// Load an existing bundle
54+
var bundle = new Bundle("path/to/dir");
55+
bundle.LoadFromFile();
56+
57+
// Get certificate hash
58+
string certificateHash = bundle.Signatures.Entries.First().Key;
59+
60+
// Verify certificate
61+
bool isCertificateValid = bundle.VerifyCertificate(certificateHash);
62+
63+
// Verify signature
64+
bool isSignatureValid = bundle.VerifySignature(certificateHash);
65+
66+
// Verify files integrity
67+
bool isFileValid = bundle.VerifyFileIntegrity("file1.txt");
68+
bool isFile2Valid = bundle.VerifyFileIntegrity("file2.txt");
69+
70+
```
71+
72+
## Command Line Interface
73+
74+
Easy Sign also provides a command line interface (CLI) for signing and verifying files. To install the CLI tool, use the following command:
75+
76+
77+
```
78+
dotnet tool install -g SAPTeam.EasySign.Tool
79+
80+
```
81+
82+
For more informations, see the [CLI Readme](https://github.com/SAPTeamDEV/EasySign/blob/master/src/EasySign.Cli/README.md).
83+
484

585
## License
686

7-
This project is licensed under the MIT License.
87+
This project is licensed under the MIT License.

src/EasySign.Cli/README.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,98 @@
11
# Easy Sign Command Line Interface
22

3-
Simple .NET Tool for signing and verifying files.
3+
Easy Sign CLI is a simple .NET tool for signing and verifying files. It supports multiple .NET targets, including .NET 6, .NET 8, and .NET 9.
4+
5+
## Features
6+
7+
- Create and update eSign bundles.
8+
- Sign bundles with X.509 certificates.
9+
- Verify file integrity and signatures within bundles.
10+
- Support for concurrent operations.
11+
12+
## Installation
13+
14+
To install the Easy Sign CLI tool, use the following command:
15+
16+
17+
```
18+
dotnet tool install -g SAPTeam.EasySign.Tool
19+
20+
```
21+
22+
## Usage
23+
24+
### Commands
25+
26+
#### `add`
27+
28+
Creates a new bundle or updates an existing one by adding files from the specified directory.
29+
30+
31+
```
32+
esign add <directory> [-f <bundleFileName>]
33+
34+
```
35+
36+
- `directory`: The working directory containing the eSign bundle and files to be added to the bundle.
37+
- `-f`: (Optional) The name of the bundle file. Default is `.eSign`.
38+
39+
#### `sign`
40+
41+
Signs the bundle with a specified certificate.
42+
43+
44+
```
45+
esign sign <directory> [-f <bundleFileName>] [--pfx <pfxFilePath>] [--pfx-password <pfxFilePassword>] [--no-password]
46+
47+
```
48+
49+
- `directory`: The working directory containing the bundle to be signed.
50+
- `-f`: (Optional) The name of the bundle file. Default is `.eSign`.
51+
- `--pfx`: (Optional) The path to the PFX file containing the certificate and private key.
52+
- `--pfx-password`: (Optional) The password for the PFX file.
53+
- `--no-password`: (Optional) Ignore the PFX file password prompt.
54+
55+
#### `verify`
56+
57+
Verifies the file integrity and signatures of the bundle.
58+
59+
60+
```
61+
esign verify <directory> [-f <bundleFileName>]
62+
63+
```
64+
65+
- `directory`: The working directory containing the bundle to be verified.
66+
- `-f`: (Optional) The name of the bundle file. Default is `.eSign`.
67+
68+
## Examples
69+
70+
### Adding Files to a Bundle
71+
72+
if there is no bundle file in the directory, a new bundle will be created. Otherwise, the files will be added to the existing bundle.
73+
74+
75+
```
76+
esign add /path/to/dir
77+
78+
```
79+
80+
### Signing a Bundle
81+
82+
83+
```
84+
esign sign /path/to/dir --pfx /path/to/certificate.pfx --pfx-password mypassword
85+
86+
```
87+
88+
### Verifying a Bundle
89+
90+
91+
```
92+
esign verify /path/to/dir
93+
94+
```
495

596
## License
697

7-
This project is licensed under the MIT License.
98+
This project is licensed under the MIT License.

0 commit comments

Comments
 (0)