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).


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-----

     -----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?


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]
    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]

    pub   dsa1024 2008-05-25 [SCA]

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

Also available on Keybase


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

2 Answers 2


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.

  • 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

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 .