Skip to content

Commit

Permalink
GPG advanced key management
Browse files Browse the repository at this point in the history
  • Loading branch information
SlugFiller committed Sep 14, 2023
1 parent 9345f28 commit c0357c0
Show file tree
Hide file tree
Showing 15 changed files with 529 additions and 324 deletions.
40 changes: 33 additions & 7 deletions doc/README-GPG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Thanks!
Run

```
$ (trezor|keepkey|ledger|jade|onlykey)-gpg init "Roman Zeyde <[email protected]>"
$ (trezor|keepkey|ledger|jade|onlykey)-gpg init
$ (trezor|keepkey|ledger|jade|onlykey)-gpg add -d "Roman Zeyde <[email protected]>"
```

Follow the instructions provided to complete the setup. Keep note of the timestamp value which you'll need if you want to regenerate the key later.
Expand Down Expand Up @@ -137,13 +138,14 @@ $ gpg2 --export '[email protected]' | gpg2 --list-packets | grep created | head -n1

After your main identity is created, you can add new user IDs using the regular GnuPG commands:
```
$ trezor-gpg init "Foobar" -vv
$ trezor-gpg init
$ trezor-gpg add -d "Foobar" -vv
$ export GNUPGHOME=${HOME}/.gnupg/trezor
$ gpg2 -K
------------------------------------------
sec nistp256/6275E7DA 2017-12-05 [SC]
sec nistp256/6275E7DA 1970-01-01 [SC]
uid [ultimate] Foobar
ssb nistp256/35F58F26 2017-12-05 [E]
ssb nistp256/35F58F26 1970-01-01 [E]
$ gpg2 --edit Foobar
gpg> adduid
Expand All @@ -159,10 +161,24 @@ gpg> save
$ gpg2 -K
------------------------------------------
sec nistp256/6275E7DA 2017-12-05 [SC]
sec nistp256/6275E7DA 1970-01-01 [SC]
uid [ultimate] Xyzzy
uid [ultimate] Foobar
ssb nistp256/35F58F26 2017-12-05 [E]
ssb nistp256/35F58F26 1970-01-01 [E]
```

This adds new user IDs to the same key. You can also add a new key using the `add` command:
```
$ trezor-gpg add "Xyzzy" -vv
$ gpg2 -K
------------------------------------------
sec nistp256/6275E7DA 1970-01-01 [SC]
uid [ultimate] Foobar
ssb nistp256/35F58F26 1970-01-01 [E]
sec nistp256/BE61C208 1970-01-01 [SC]
uid [ultimate] Xyzzy
ssb nistp256/65088366 1970-01-01 [E]
```

### Generate GnuPG subkeys
Expand All @@ -173,7 +189,17 @@ pub rsa2048/90C4064B 2017-10-10 [SC]
uid [ultimate] foobar
sub rsa2048/4DD05FF0 2017-10-10 [E]
$ trezor-gpg init "foobar" --subkey
$ trezor-gpg add "foobar" --subkey
```

If you have already set the new folder as your default profile, and you want to add the subkey to an existing GnuPG from a previous (e.g. non-hardware) profile, you can specify the previous profile location using `--primary-homedir`:
```
$ gpg2 -k foobar --homedir ~/.gnupg
pub rsa2048/90C4064B 2017-10-10 [SC]
uid [ultimate] foobar
sub rsa2048/4DD05FF0 2017-10-10 [E]
$ trezor-gpg add "foobar" --subkey --primary-homedir ~/.gnupg
```

[![asciicast](https://asciinema.org/a/Ick5G724zrZRFsGY7ZUdFSnV1.png)](https://asciinema.org/a/Ick5G724zrZRFsGY7ZUdFSnV1)
Expand Down
11 changes: 10 additions & 1 deletion doc/README-Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ git clone https://github.com/romanz/trezor-agent.git

Build and install the library:
```
pip install ./trezor-agent
```
If you want to be able to edit it without having to rebuild, use this command instead:
```
pip install -e trezor-agent
```

Build and install the agent of your choice:
```
pip install ./trezor-agent/agents/<device>
```
If you want to be able to edit it without having to rebuild, use this command instead:
```
pip install -e trezor-agent/agents/<device>
```

Expand Down Expand Up @@ -166,7 +174,8 @@ choco install gpg4win

You must first create a signing identity:
```
<device>-gpg init -e ed25519 "My Full Name <[email protected]>"
<device>-gpg init
<device>-gpg add -d -e ed25519 "My Full Name <[email protected]>"
```
You will be asked for confirmation on your device **twice**.

Expand Down
Loading

0 comments on commit c0357c0

Please sign in to comment.