4

Here's a specific scenario that I have.

I want to have subkeys on my laptop and store the master key safely.

So I went ahead and created new keys:

gpg --gen-key
gpg (GnuPG/MacGPG2) 2.0.20; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 8192 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: John Nash
Email address: jnash@somedomain.com
Comment:
You selected this USER-ID:
    "John Nash <jnash@somedomain.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 6750A605 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   4  signed:   1  trust: 0-, 0q, 0n, 0m, 0f, 4u
gpg: depth: 1  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 1f, 0u
gpg: next trustdb check due at 2015-01-02
pub   1024R/6750A605 2014-09-10
      Key fingerprint = BAB9 E8A4 4191 1B99 F8D1  ED09 544A F1E9 6750 A605
uid                  John Nash <jnash@somedomain.com>
sub   1024R/68E051E2 2014-09-10

And as seen, I have created a default set of keys that generated a subkey for encryption. After I've created a new signing key:

gpg --edit-key jnash
gpg (GnuPG/MacGPG2) 2.0.20; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub  1024R/6750A605  created: 2014-09-10  expires: never       usage: SC
                     trust: ultimate      validity: ultimate
sub  1024R/68E051E2  created: 2014-09-10  expires: never       usage: E
[ultimate] (1). John Nash <jnash@somedomain.com>

gpg> addkey
Key is protected.

You need a passphrase to unlock the secret key for
user: "John Nash <jnash@somedomain.com>"
1024-bit RSA key, ID 6750A605, created 2014-09-10

Please select what kind of key you want:
   (3) DSA (sign only)
   (4) RSA (sign only)
   (5) Elgamal (encrypt only)
   (6) RSA (encrypt only)
Your selection? 4
RSA keys may be between 1024 and 8192 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y
Really create? (y/N) y
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

pub  1024R/6750A605  created: 2014-09-10  expires: never       usage: SC
                     trust: ultimate      validity: ultimate
sub  1024R/68E051E2  created: 2014-09-10  expires: never       usage: E
sub  1024R/C1DC3BB6  created: 2014-09-10  expires: never       usage: S
[ultimate] (1). John Nash <jnash@somedomain.com>

This left me with the following subkeys:

pub  1024R/6750A605  created: 2014-09-10  expires: never       usage: SC
                         trust: ultimate      validity: ultimate
sub  1024R/68E051E2  created: 2014-09-10  expires: never       usage: E
sub  1024R/C1DC3BB6  created: 2014-09-10  expires: never       usage: S

After I've exported the subkeys and the master key from the key ring:

gpg --export-secret-key jnash --armor > masterkey
gpg --export-secret-subkeys jnash --armor > subkeys
gpg --delete-secret-key jnash

And imported the subkeys only with gpg --import subkeys that left me with the following output when running gpg -K

sec#  1024R/6750A605 2014-09-10
uid                  John Nash <jnash@somedomain.com>
ssb   1024R/68E051E2 2014-09-10
ssb   1024R/C1DC3BB6 2014-09-10

From my understanding, now I don't have the master key anymore and this computer is ready to go on travel.

Now, let's say I got stolen and my keys are compromised.

I will need to revoke 68E051E2 and C1DC3BB6 right?

But after doing so and replacing them with new ones, I won't be able to open old stuff that was encrypted and signed with both keys, will I?

-- Disclaimer: The data above is just a sample one. I would never have keys with only 1024 in key size.

  • Just wondering, but where do you store your master keys and keyring right now? – mincewind Dec 18 '14 at 13:32
1

Now, let's say I got stolen and my keys are compromised. I will need to revoke 68E051E2 and C1DC3BB6 right?

Assuming the person who stole your computer even knows what GPG is, was able to break the passphrase used to encrypt the keyring on your computer, and plans to use those keys for nefarious reasons? Definitely!

On the other hand, if he stole your computer, wiped everything on it (or didn't wipe it), and pawned it? Maybe, depends on how paranoid you are and how important your keyring integrity is to you.

But after doing so and replacing them with new ones, I won't be able to open old stuff that was encrypted and signed with both keys, will I?

When you revoke the old subkeys, they still stay on your keyring, however, they are clearly marked as revoked. That way, people who contact you will know you once owned those keys, but for some reason do not use them any longer.

With encryption subkeys, if you still have a backup copy of the private half of your subkeys, you can still decrypt old messages that have been encrypted and sent to you in the past. However, so can the person who stole the computer with your keys! This is why switching to a new keypair as soon as possible is very important.

If some of your contacts don't know the key was compromised (maybe they don't update their keyring regularly, and haven't "seen" that you revoked the old subkeys yet) and are still encrypting using your old public key, the key-snatching thief can decrypt any new messages they send you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.