verification example

This commit is contained in:
Lance Vick 2023-05-29 17:11:36 -07:00
parent 4f7b703cbb
commit a2d38d4ce9
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 24 additions and 12 deletions

View File

@ -68,21 +68,33 @@ they appear in all capitals, as shown here.
## Examples ## Examples
### Bash: Git and pgp with plaintext review ### Signature Generation
#### Shell: Git and GPG with plaintext review
``` ```
local -r review_body="LGTM" review="LGTM"
local -r review_hash="$(printf $review_body | openssl sha256 | awk '{print $2}')" review_hash="$(printf $review | openssl sha256 | awk '{print $2}')"
local -r vcs_ref="$(git rev-parse HEAD)" vcs_ref="$(git rev-parse HEAD)"
local -r tree_hash="$(git rev-parse 'HEAD^{tree}')" tree_hash="$(git rev-parse 'HEAD^{tree}')"
local -r sig_body="sig:v0:$vcs_ref:$tree_hash:$review_hash:pgp" body="sig:v0:$vcs_ref:$tree_hash:$review_hash:pgp"
local -r sig=$(\ sig=$(printf "%s" "$body" | gpg --detach-sign | openssl base64 -A )
printf "%s" "$body" \ printf "%s" "$body:$review:$sig"
| gpg --detach-sign \
| openssl base64 -A \
)
printf "%s" "$sig_body:$review_body:$sig"
``` ```
### Signature Verification
#### PGP
```
gpg --verify <(printf "$sig_body") <(printf "$sig")
```
### Review Verification
TODO
## Background ## Background
TODO TODO