You are not logged in.

#1 2015-03-31 21:48:39

nstgc
Member
Registered: 2014-03-17
Posts: 393

[Solved] GnuPG (gpg: file: encryption failed: No public key)

I'm trying to encrypt a file with GnuPG to upload to a cloud server (Amazon is now offering free unlimited storage for 3 months and $60/year there after). I searched Google on the topic and came to https://serverfault.com/questions/48914 … es-in-unix. I followed the guide as well as the Arch Wiki article, however I get the error "gpg: file: encryption failed: No public key" when I try to encrypt anything.

$ gpg -encrypt --recipient 'name' -o file.gpg file

I then ran a search for this coming to: http://security.stackexchange.com/quest … rypt-fails

It is suggested to set the expiration period of the secret key to 0 as a fix, however this did not work for me.

$ gpg --edit-key $keyNumber1
Secret key is available.

pub  rsa3072/$keyNumber1
     created: 2015-03-31  expires: never       usage: SC  
     trust: ultimate      validity: ultimate
sub  rsa3072/$keyNumber2
     created: 2015-03-31  expires: never       usage: E   
[ultimate] (1). $name <$email>

my gpg.conf file

personal-digest-preferences SHA512
default-key $keynumber1
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
personal-cipher-preferences TWOFISH CAMELLIA256 AES 3DES
no-greeting
default-recipient-self
keyserver hkp://keys.gnupg.net

[edit=solution] Appently I needed to set the recipient to be the key number as opposed to my name.
http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/

[edit2] According to Jason, you can also use the email address.

Last edited by nstgc (2015-04-01 01:25:15)

Offline

#2 2015-03-31 22:06:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] GnuPG (gpg: file: encryption failed: No public key)

Who, or what, is 'name'?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-03-31 22:14:27

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: [Solved] GnuPG (gpg: file: encryption failed: No public key)

That's my real name. I put $name in play of my name since I didn't want to post it online probably should have just used nstgc.

Thank you for the reply. I thought to check another tutorial, and it seems I needed to use the key number as the precipitant instead. http://blog.sanctum.geek.nz/linux-crypto-gnupg-usage/

This is solved.

Offline

#4 2015-03-31 22:15:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] GnuPG (gpg: file: encryption failed: No public key)

Any email address associated with the key will work as well (and is easier to remember)...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB