Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwertovsky committed Jan 5, 2024
1 parent e2fe8d2 commit 1a0b6d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It uses the Bouncy Castle algorithm implementation or the Rutoken implementation

## Sign file with token. Result will be file.pdf.sig. Source file will be attached.
```
java -jar gost_sign.jar -i file.pdf --pkcs-id 74657374 --pkcs-library /usr/lib/librtpkcs11ecp.so -d 2022-12-31T23:59:59+03:00
java -jar gost_sign.jar -i file.pdf --pkcs-id test --pkcs-library /usr/lib/librtpkcs11ecp.so -d 2022-12-31T23:59:59+03:00
```

Options:
Expand All @@ -19,10 +19,15 @@ option key | argument | default | description
--pkcs-id | text | | Certificate id on token. Private and public keys should share this id. Id is ASCII encoded (74657374 = test)
--pkcs-library | file | | Path to PKCS library

Write certificate on token:

```
pkcs11-tool --module /usr/lib/librtpkcs11ecp.so --type cert --login --write-object test.pem --id 74657374
```

## Add signature to PDF document
```
java -jar gost_sign.jar -i file.pdf --pkcs-id 74657374 --pkcs-library /usr/lib/librtpkcs11ecp.so --pdf --pdf-visual --pdf-position-x 100 --pdf-position-y 100
java -jar gost_sign.jar -i file.pdf --pkcs-id test --pkcs-library /usr/lib/librtpkcs11ecp.so --pdf --pdf-visual --pdf-position-x 100 --pdf-position-y 100
```

PDf options:
Expand Down Expand Up @@ -65,8 +70,10 @@ java -jar gost_sign.jar --verify -i file.pdf --sig-file file.pdf.sig
```

## Verify pdf

If the signature is inside PDF.
```
java -jar gost_sign.jar -i file.pdf --pdf
java -jar gost_sign.jar --verify -i file.pdf --pdf
```


Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/qwertovsky/cert_gost/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ private static Options createOptions() {
Option pkcsIdOption = Option.builder()
.longOpt(CliOptions.PKCS_ID)
.argName("cert id on token")
.desc("Certificate id on token. Private and public keys should share this id")
.desc("Certificate id on token. Private and public keys should share this id."
+ " id is expected in native encoding. pkcs11-tool uses ASCII encoding")
.hasArg(true)
.build();
cliOptions.addOption(pkcsIdOption);
Expand Down

0 comments on commit 1a0b6d1

Please sign in to comment.