Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request #2

Open
PowerPress opened this issue Sep 18, 2019 · 8 comments
Open

Request #2

PowerPress opened this issue Sep 18, 2019 · 8 comments

Comments

@PowerPress
Copy link

Would you please consider adding subkey encryption keys being created and restored with this tool? I Know its not ideal but it would be a big help to people using Tails OS for Amnesia and not having to trust loading their keys of potentially malicious usb devices. That could really help a lot of people in dangerous countries or even the UK which can require people to hand over a password if an GPG key is found.

@skeeto
Copy link
Owner

skeeto commented Sep 18, 2019 via email

@PowerPress
Copy link
Author

PowerPress commented Sep 18, 2019 via email

@skeeto
Copy link
Owner

skeeto commented Sep 18, 2019

First generate the key. I've used an empty passphrase so you can do the same to see exactly the same output.

$ passphrase2pgp --subkey --uid [email protected] | gpg --import
passphrase: 
passphrase (repeat): 
gpg: /home/foo/.gnupg/trustdb.gpg: trustdb created
gpg: key BFB69BB42424AA60: public key "[email protected]" imported
gpg: key BFB69BB42424AA60: secret key imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:  secret keys unchanged: 1

Note, this doesn't protect the key with a passphrase, so it will be stored unencrypted on the GnuPG keyring. Whether or not that matters depends on your computer's configuration and how you use your computer. Use passphrase2pgp's --protect (-e) option to add protection if needed. (I really wish GnuPG had an option to add protection to secret keys as they're being imported. Sadly, it does not.)

So far everything looks good. We've got an a sign/certify/authenticate Ed25519 primary key and an encryption Curve25519 subkey:

$ gpg --list-keys
/home/foo/.gnupg/pubring.kbx
------------------------------
pub   ed25519 1970-01-01 [SCA]
      32FE19AE744B5F668F299CBABFB69BB42424AA60
uid           [ unknown] [email protected]
sub   cv25519 1970-01-01 [E]

If you have a notion of what your fingerprint should be, listing the keys like this will let you triple check that you've entered your passphrase correctly.

Now to encrypt a message, hello.txt. It will prompt me about trust since imported keys aren't trusted by default. To disable this, use GnuPG's --trusted-key, select a different --trust-model, or use --edit-key to change the trust on your key. (There's nothing passphrase2pgp can do to force a key to be trusted.)

$ echo hello > hello.txt
$ gpg --encrypt --recipient [email protected] hello.txt 
gpg: 971FB333228465B2: There is no assurance this key belongs to the named user

sub  cv25519/971FB333228465B2 1970-01-01 [email protected]
 Primary key fingerprint: 32FE 19AE 744B 5F66 8F29  9CBA BFB6 9BB4 2424 AA60
      Subkey fingerprint: 526A C547 E142 64D6 7448  F9B1 971F B333 2284 65B2

It is NOT certain that the key belongs to the person named
in the user ID.  If you *really* know what you are doing,
you may answer the next question with yes.

Use this key anyway? (y/N) y

That produces hello.txt.gpg. In another session, you can regenerate the key per the above instructions, and then decrypt like so:

$ gpg --decrypt hello.txt.gpg 
gpg: encrypted with 256-bit ECDH key, ID 971FB333228465B2, created 1970-01-01
      "[email protected]"
hello

@PowerPress
Copy link
Author

PowerPress commented Sep 19, 2019 via email

@skeeto
Copy link
Owner

skeeto commented Sep 19, 2019 via email

@jonathancross
Copy link

Is it possible to generate sign + authenticate as subkeys?

@skeeto
Copy link
Owner

skeeto commented Apr 29, 2021 via email

@jonathancross
Copy link

I was thinking that this could be used to generate so-called "Laptop Keys" (subkeys with striped primary key) on an air-gapped machine while having a simple backup / restore method for the private keys. Passphrase could just be written on paper, so no storage would be needed if I am understanding correctly.

In my case I have a primary [C] key and 3 subkeys [S],[E],[A] and the backup from the air-gapped machine is challenging / error-prone. The 3 subkeys are loaded onto a hardware device such as Yubikey for everyday use.

I'd like my next key to use Curve25519 and have a more future-proof, simple, paper backup (without trusting a printer). Trying to figure out if passphrase2pgp would be the way to go as there doesn't seem to be a good mnemonic standard (like we have in Bitcoin's BIP39).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants