1

I'm trying to decrypt a message using my personal secret key.

When I try to decrypt the message (using gpg --decrypt message.txt), I get the following error:

gpg: encrypted with RSA key, ID 3810D17A
gpg: decryption failed: No secret key

I believe the reason for this to be the following:

When I run gpg --list-key i get the following output:

/Users/sahandz/.gnupg/pubring.gpg
---------------------------------
pub   2048D/00D026C4 2010-08-19 [expires: 2018-08-19]
uid       [ultimate] GPGTools Team <team@gpgtools.org>
uid       [ultimate] GPGMail Project Team (Official OpenPGP Key) <gpgmail-devel@lists.gpgmail.org>
uid       [ultimate] GPGTools Project Team (Official OpenPGP Key) <gpgtools-org@lists.gpgtools.org>
uid       [ultimate] [jpeg image of size 5871]
sub   2048g/DBCBE671 2010-08-19 [expires: 2018-08-19]
sub   4096R/0D9E43F5 2014-04-08 [expires: 2024-01-02]

pub   2048R/8D596035 2012-09-12
uid       [ unknown] Sonja Buchegger (CSC) <buc@csc.kth.se>
sub   2048R/0C6AB020 2012-09-12

pub   2048R/E22ECA45 2015-11-13 [expires: 2016-02-11]
uid       [ultimate] Sahand Zarrinkoub (DD2395) <sahandz@hotmail.com>
uid       [ultimate] Sahand Zarrinkoub (DD2395) <sahandz@kth.se>
sub   2048R/F16B7DCC 2015-11-13 [expires: 2016-02-11]

pub   2048R/CA0EC350 2012-09-11 [expires: 2022-09-09]
uid       [  full  ] Computer Security (course key) <gpg@dasak.csc.kth.se>
sub   2048R/51C9E3E9 2012-09-11 [expires: 2022-09-09]

As you can see there is no secret key listed here.

However, if look in the GUI (GPG keychain, using my macbook) I can indeed see that there is a secret/public key pair that is my personal one.

How can I fix this? I would very much like to keep the key pair I created originally rather than creating a new one.

  • Do you also have gpg2 around, what will gpg2 --version omit? – Jens Erat Nov 17 '15 at 22:35
  • I wrote gpg2 --version in the command line and got the following: gpg (GnuPG/MacGPG2) 2.0.28 libgcrypt 1.6.3 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later Home: ~/.gnupg Supported algorithms: Pubkey: RSA, RSA, RSA, ELG, DSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 – Sandi Nov 18 '15 at 9:29
  • I should add that I run GPG on Mac OS El Capitan. – Sandi Nov 18 '15 at 9:39
0

A quick key server search reveals that subkey 3810D17A belongs to primary key E0438FE3, which is not even listed as public key. It looks like you simply don't have the key at all.

The message wasn't encrypted for you (or to be more precise, your key pair). gpg --list-keys only lists the public keys, run gpg --list-secret-keys to print those.

GnuPG 2.1 changed the location of secret keys from the old secring.gpg file by merging them into pubring.gpg; if you're using both GnuPG 2.1 or newer together with an older version (you can have multiple installed at the same time, often gpg is GnuPG version 1 and gpg2 is GnuPG version 2 or newer), you might get different results depending on which version you're using. You're not affected by this (yet), as you're still pre-GnuPG 2.1 (which is really new and not broadly distributed by now).

0

--list-keys only lists public keys. To list secret keys, use --list-secret-keys (or just -K).

If you don't have a secret key with ID 3810D17A, you can't decrypt the message. Creating a new keypair would not help with this, unless your correspondent is willing to re-encrypt the message with your new public key.

If you do have that key, I'm not sure why the software isn't just using it. The --list-packets option may shed some light on what's in the message, how it was encrypted, etc.

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.