Skip to content

Commit

Permalink
Add pgp-wrapper example
Browse files Browse the repository at this point in the history
Creates an OpenPGP certificate based on the SSH key and allows signing files
emitting OpenPGP framed packets.

Requires that the first key in SSH is ed25519 (see `ssh-add -L`).

Generate a key with:
`cargo run --example pgp-wrapper generate "John Doe <[email protected]>" > key.pgp`

Sign data using:
`cargo run --example pgp-wrapper sign < Cargo.toml > Cargo.toml.sig`

Import the certificate using GnuPG:
```sh
$ gpg --import key.pgp
gpg: key A142E92C91BE3AD5: public key "John Doe <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1
```

Verify the signature using GnuPG:
```sh
$ gpg --verify Cargo.toml.sig
gpg: assuming signed data in 'Cargo.toml'
gpg: Signature made Fri May 10 11:15:53 2024 CEST
gpg:                using EDDSA key 4EB27E153DDC454364B36B59A142E92C91BE3AD5
gpg: Good signature from "John Doe <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 4EB2 7E15 3DDC 4543 64B3  6B59 A142 E92C 91BE 3AD5
```

Works perfectly in conjunction with `openpgp-card-agent.rs`!

Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
  • Loading branch information
wiktor-k committed May 10, 2024
1 parent f07a436 commit 8d6ff16
Show file tree
Hide file tree
Showing 3 changed files with 968 additions and 10 deletions.
Loading

0 comments on commit 8d6ff16

Please sign in to comment.