7

I recently read:

You should sign your PGP public key immediately after generating your public/private key-pair.

And now I wonder how I can check whether I already did that. So my question is: how can I tell if my own pgp public key is self-signed or not?

I'm using GnuPG/MacGPG2 v2.0.

7

OpenPGP Self Signatures

Self-signatures are applied on user IDs and subkeys, and make it obvious to anybody else that the ID or subkey really have really been added by yourself. User IDs and subkeys not selfsigned could have been added by anybody and uploaded to the key servers.

Usually, self-signatures are created automatically by GnuPG, so you don't need to care about anything.

Checking for Self Signatures

Using the terminal, checking for self signatures is achieved very easily. Self-signatures are listed among the others, so all you need to do is filter for user IDs, subkeys and their respective next lines (which should contain the self signature).

gpg --list-sigs [key-id] |grep -EA1 '^(sub|uid)'

If you have a user ID or subkey which does not have a signature issued by your own key in the next line, you still might have to look through the whole output following this user ID/subkey -- so look through the whole gpg --list-sigs [key-id] output, find the subkey, and see if there's a self-signature line below.

In the example output for my own key, you can easily see that each uid or sub line is followed by a signature issued by the primary key itself, confirming all of them are self-signed.

$ gpg --list-sigs a4ff2279 |grep -EA1 '^(sub|uid)'
uid                            Jens Erat (born 1988-01-19 in Stuttgart, Germany)
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
uid                            Jens Erat <jens.erat@fsfe.org>
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
uid                            Jens Erat <jens.erat@uni-konstanz.de>
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
uid                            Jens Erat <jabber@jenserat.de>
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
uid                            Jens Erat <email@jenserat.de>
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
uid                            [jpeg image of size 12899]
sig 3        0x4E1F799AA4FF2279 2012-12-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
--
sub   2048R/0x9FF7E53ACB4BD3EE 2013-01-23 [expires: 2023-01-21]
sig          0x4E1F799AA4FF2279 2013-01-23  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
sub   2048R/0x5C88F5D83E2554DF 2013-01-23 [expires: 2023-01-21]
sig          0x4E1F799AA4FF2279 2013-01-23  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
sub   4096R/0x8E78E44DFB1B55E9 2014-03-26 [expires: 2017-03-25]
sig          0x4E1F799AA4FF2279 2014-03-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
sub   4096R/0xCC73B287A4388025 2014-03-26 [expires: 2017-03-25]
sig          0x4E1F799AA4FF2279 2014-03-26  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
sub   4096R/0x382D23D4C9773A5C 2014-11-22 [expires: 2016-11-21]
sig     P    0x4E1F799AA4FF2279 2014-11-22  Jens Erat (born 1988-01-19 in Stuttgart, Germany)
  • Thanks for your answer and +1. Just to be sure: I ran gpg --list-sigs [key-id] |grep -EA1 '^(sub|uid)' and now I see two uid / sig 3s (for two email addresses using the same key pair) followed by a sub / sig line. Is that the confirmation of self-signature? – docendo discimus May 31 '15 at 10:15
  • 1
    If you're not missing any sig line containing your key ID for a sub or uid line, you're fine. I added an example for my key. – Jens Erat May 31 '15 at 10:30

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.