2

Strange issue: A friend of mine sent me his public OpenPGP key.

I tried the following:

Method 1

  • Pasted his OpenPGP key block into a .txt file
  • Launched seahorse and clicked on File > Import
  • Selected the .txt file
  • Click import
  • Nothing happens, no error message, no feedback and cannot see the key under PGP Keys in seahorse

Method 2

In terminal I run the following:

sudo gpg --import key.txt

No error message. But I still cannot see the key anywhere.

When I try to decrypt the test email that my friend sent me using Enigmail in Thunderbird, I am informed that no corresponding key could be found.

I am using Ubuntu 14.04 LTS.

Any tips would greatly be appreciated.

Update:

:public key packet:
    version 4, algo 1, created 1341176567, expires 0
    pkey[0]: [2048 bits]
    pkey[1]: [17 bits]
    keyid: 92729696A35FA089
:user ID packet: "John Do <john@do.net>"
:signature packet: algo 1, keyid 93729646B35FA089
    version 4, created 1341176567, md5len 0, sigclass 0x13
    digest algo 2, begin of digest 49 e6
    hashed subpkt 2 len 4 (sig created 2012-07-01)
    hashed subpkt 27 len 1 (key flags: 03)
    hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2)
    hashed subpkt 21 len 5 (pref-hash-algos: 8 2 9 10 11)
    hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
    hashed subpkt 30 len 1 (features: 01)
    hashed subpkt 23 len 1 (key server preferences: 80)
    subpkt 16 len 8 (issuer key ID 93729646B35FA089)
    data: [2047 bits]
:public sub key packet:
    version 4, algo 1, created 1341176567, expires 0
    pkey[0]: [2048 bits]
    pkey[1]: [17 bits]
    keyid: 91C2606F92AC4FBA
:signature packet: algo 1, keyid 93729646B35FA089
    version 4, created 1341176567, md5len 0, sigclass 0x18
    digest algo 2, begin of digest 36 aa
    hashed subpkt 2 len 4 (sig created 2012-07-01)
    hashed subpkt 27 len 1 (key flags: 0C)
    subpkt 16 len 8 (issuer key ID 93729646B35FA089)
    data: [2047 bits]
2
  • You shouldn't need sudo to import keys to GnuPG. Anyway: What does gpg --list-packets <key.txt print?
    – Jens Erat
    Jul 18, 2015 at 7:28
  • @JensErat added the output.
    – BrokenCode
    Jul 18, 2015 at 9:48

2 Answers 2

3

Importing keys

The key you want to import is a normal public OpenPGP key, nothing special, so there should not be any problems.

I guess you ran into two different issues.

  1. Using the Seahorse GUI

    For importing a key, you did everything right. But by default, Seahorse only shows your own keys (i.e. those, for which you have the private key). Click "View" and "Show any" to see the public key.

  2. Using the command line

    sudo gpg --import <file will import into root's GnuPG keyring, which is probably not want to you want to achieve. Import to your user's keyring instead by omitting sudo:

    gpg --import key.txt
    

    Afterwards, it should be visible running

    gpg --list-keys

    Very likely you already imported it successfully, anyway.

Private and Public Keys

Another issue you have seems to be the understanding of public/private key cryptography. With the key listed above, you will not be able to decrypt mail, you need the private key to decrypt a message. Public keys can only be used to encrypt messages to others (and verify the other's signatures), but not decrypting messages encrypted using that public key.

If you want to exchange messages with a friend using OpenPGP (or public/private key cryptography in general, eg. using S/MIME), each of you should generate his own key pair. Now exchange the public keys. If you want to send a message to your friend, use his public key to encrypt the message, now he will be able to decrypt it using his private key. The same applies the other way round.

0

You have to use sudo try this in the terminal:

  wget -o- (path and key.txt | sudo apt-add key (gpg)

and it might work fine this way.

2
  • But does your method add my friends public pgp key as an apt key?
    – BrokenCode
    Jul 18, 2015 at 5:59
  • Yes it dos as I know from my computer
    – Michael
    Jul 18, 2015 at 19:21

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.