4

I need help with two PGP / GPG issues:

  1. Ensuring that my thinking is correct (i.e., I really do need another GPG subkey for my scenario)
  2. Ensuring that I create the subkey correctly without compromising my current keys (bonus to any extra constructive criticism / suggestions from the data exposed).

GPG SUBKEY SCENARIO

I use my GPG key for:

  1. Encrypting and/or signing some email conversations
  2. Signing my Git commits

There has been something that has bugged me for a while now regarding using the same key for both.

As pointed out in the Alan Turing movie, "The Imitation Game" (2014), the Enigma encoded messages were cracked only after the namespace was cut down dramatically. The machine Turing built couldn't try enough combinations before the ciphers were changed. However, by cutting the namespace down dramatically, they were able to decipher the messages.

The way the namespace was cut down was by finding a phrase known to be in every coded message. Again, referring to the Turing movie, if I remember correctly, this phrase was "Heil Hitler" signed at the bottom of every German message.

Encrypting an email message does not concern me as the typical email headers are not part of the message that is being encrypted. However, if one looks at the internal structure of a Git commit, it always contains "tree", "author" and "committer." And, except for one commit, it also always includes "parent".

Additionally, we can assume the "author" and "committer" will often be the same. In the example below "Glen Jarvis ". Here is an example of a signed commit message that I have recently made (unsigned commit messages had the same structure as signed commit messages — the are only missing the "gpgsig" key and its following multiline value):

    tree 29d37a46658eaeb764b587a105be5eabc2d6a641
    parent 45646279562c74461e7237104e9f335ac3054635
    author Glen Jarvis <[email protected]> 1500272497 -0700
    committer Glen Jarvis <[email protected]> 1500272497 -0700
    gpgsig -----BEGIN PGP SIGNATURE-----

     iQIcBAABAgAGBQJZbFd3AAoJEJF24vsEed5ckiEP/26n9kfkwx2i0z+hhlDTytYP
     qlFvHRgv4djOQCZkbDiRU5PS3G5dS9LQpVJ/bHrXLKfUPhB/pux64XEv+mTRqrk3
     ncgGt0sEWoIaZhHhY5Cyc+2MCoNgDCIxSexP7X5bvxRwO1cGeuJ4AfmcL/Fp+xRz
     vFaPINSZJMvXqJBFnnNFltFFSe4HRA+wloTLyk9zpJ7LnOKMHNbkPCxmf2dqBjmL
     ZEi9VFM9r0EYmXmZSF1KThCXy2dZDMPhRhe8VwPXQ8jXMSChhwSD+wFT79+xF/Fg
     hq2vpD9vkqcYUfucobNzz7T17Fr7ICuZvhGXxOwYk079p9SyPpN9U3VuqayEyV6O
     B49J8tcblu1XfrGh151Lhp6Fjr2TbKecnB2q/XgaH7MsaR99xt1UFaKVlMtbTn95
     vqTSieyG3IPSjp+17oXev83IHXMvIKCetx5r3D9vUrKd4HVPAzzjfDjSO99Smz2J
     2UKHep7da0SOpN/bn/x13CzYW9MCtN0FFAYogIuDu61HnlhOik+WqMm+uCvgmtzm
     0BdSEPAn9udvpAkHRcEd3a2JYABvheEjgDhqWLy9iL1Z+wKP9Sz5Mh9xYVI6AA8V
     Cs6vyYJqoS5GRGh0UNR26hafpCcIbXZLjXVkxWVzZGYqHpf+adBOiOmrtRF87Fz4
     3hgDVlhzTagHBw3HEmWD
     =juvL
     -----END PGP SIGNATURE-----

    Switch to Wheel format


My concern is that, by using the same GPG key to sign these commit messages and encrypt/sign email messages, I am weakening my key so that my email messages may be more easily decrypted. My Git commits are publicly available in GitHub. 

Is my thinking sound?

CREATING SUBKEY

Assuming my thinking above is correct and this is a concern, I need help making the correct subkey. I can encrypt my email messages with F27C. And, I can sign my commit messages with a subkey if I can create it correctly. I already understand how to configure Git to choose which subkey to use in signing.

Here is a list of my public keys (some are clearly expired, have been rotated over time, and are here only for reference):

    $ gpg --list-keys [email protected]
    pub   rsa2048 2012-05-28 [SCEA]
          F27CA351FD010F450D2B1431DBCBDF2F36703FB2
    uid           [ unknown] Glen Jarvis (glenjarvis.com) <[email protected]>
    uid           [ unknown] [jpeg image of size 7125]
    sub   rsa4096 2016-06-05 [S] [expires: 2021-06-04]

    pub   rsa2048 2012-05-07 [SCEA]
          B560A0D698E1E0267AA81F7DACD3887417F3CCD7

    pub   dsa1024 2008-05-25 [SCA]
          8D6D27687BA839C9C88F4FE50B00116142CE11B6

    pub   dsa1024 2010-04-03 [SC]
          63A1BBC8DCC51CA5E7CA1A4889B35CEFA08FF5FD
    uid           [ unknown] Glen Jarvis <[email protected]>
    sub   elg1024 2010-04-03 [E]

Also available on Keybase

BONUS

Any unsolicited advice (from data exposed in this question) is also welcome.

2 Answers 2

3

TL;DR: No.

When you are signing your commits, what you are doing is encrypting a hash over a text with your private key (thus enabling others to decrypt this with your public key and comparing the hash with the hash they build over the same text.

Because cryptographically secure hash functions do change significantly in outcome when small portions of the input change, repeating words in the signed plain text are not a problem.

Additionally, comparing modern cryptography with the enigma is not actually reasonable.

Even if you encrypted the same text different times, you'd still end up with different encryptions. That is because modern cryptography is designed to withstand so called known plaintext attacks (and every encryption is indistinguishable from random data). This has something to do with block cipher modes of operation.

I'm not too sure if that is the default in GPG but usually, asymmetric crypto systems like GPG actually use hybrid encryption: you create a random key and encrypt that key with the public key of the recipient. The message is then encrypted with a block cipher (like AES) in a good mode of operation (like CBC, where the result of each block is influencing the next block) using the randomly created key from before.

Thus, even the exact same message to the same recipient is not going to yield the same cipher text - as with the enigma. partially equal messages are not a problem either.

Edit for bonus: sub-keys are not part of the OpenPGP protocol and thus are not compatible with all OpenPGP implementations, so be prepared to run into problems when someone is not using GPG but PGP.

3
  • 1
    Thank you (especially for this "comparing modern cryptography with the enigma is not actually reasonable."). I considered this may be true, but didn't have enough solid training to be certain. As for subkeys, I don't need them anymore. As long as I can use my same key for both, it makes my life simpler :) Aug 21, 2017 at 4:40
  • By the way, fun fact: the enigma had another flaw that allowed for breaking it: it was a character-based encryption and never encrypted any character with itself.
    – Tobi Nary
    Aug 21, 2017 at 4:44
  • 2
    Welcome to sec.SE, @GlenJarvis - instead of how forums work, a "thank you" would be rather an up vote then a comment and a "this solved my question" would be an "accept this answer". This way, future readers can easily identify good answers and which answers helped with the question.
    – Tobi Nary
    Aug 21, 2017 at 5:02
0

I'm glad that the Alan Touring movie has got you thinking about encryption! But that was 70 years ago and cryptography has come a long way since then.

The type of attack you're talking about is a digital signature forgery attack. Both signature algorithms you're using, RSA and DSA are (to my knowledge) completely immune to these types of data leakage attacks.

In this day and age it's pretty much unheard of for an attacker to crack a private key; it's far easier to find some unpatched software on your laptop that has a known vulnerability, hack in and copy the private key file ;)


To be serious for a minute, you also need to consider whether you're worth the time and effort for an attacker. Does being able to forge your signature have any economic advantage to them? For example, do you use that key to sign packages for apt or yum?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .