Compare commits

..

No commits in common. "c86a09178702627330d3567a1ac2d4650337aeea" and "a2393f21cb39be580275f889b0c650cac3b2496a" have entirely different histories.

View file

@ -294,32 +294,3 @@ After that, signing works properly:
```sh ```sh
openssl ca -config /root/ca/openssl.cnf -extensions v3_intermediate_ca -days 3650 -notext -md sha256 -in intermediate.req -out intermediate.cer openssl ca -config /root/ca/openssl.cnf -extensions v3_intermediate_ca -days 3650 -notext -md sha256 -in intermediate.req -out intermediate.cer
``` ```
Check the output:
```sh
openssl x509 -in intermediate.cer -noout -text
```
# Signing Data
Create a file with secret content:
```sh
cd /root
vi secret.txt
```
## Create Signature
```sh
# Create and encrypt hash of file
openssl dgst -sha256 -sign /root/ca/private/ca.key.pem -out /tmp/hash.sha256 secret.txt
# Convert hash file to base64
openssl base64 -in /tmp/hash.sha256 -out secret.sig
```
## Verify Signature
Under normal circumstances:
```sh
# Re-create hash file from base64
openssl base64 -d -in secret.sig -out /tmp/hash.sha256
# Check integrity of `secret.txt`
openssl dgst -sha256 -verify /root/ca/ca.key.pem.pub -signature /tmp/hash.sha256 secret.txt
```