LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-24-2024, 10:47 AM   #1
nicehand90210
LQ Newbie
 
Registered: Mar 2024
Posts: 1

Rep: Reputation: 0
GPG: "decryption failed: no secret key"


I'm new to GPG and am incapable of understanding cryptology. I'm trying to decrypt a message (that should be encrypted for me) and I'm getting the error:

Quote:
gpg: public key decryption failed: No secret key
gpg: decryption failed: No secret key
My private key is listed under "gpg --list-secret-keys". pass works correctly, which suggests to me that there shouldn't be a problem.

Apologies for the n00b question. As I said, I don't understand any of this and can't begin to troubleshoot it on my own. Help greatly appreciated.
 
Old 03-24-2024, 11:44 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,357

Rep: Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332Reputation: 2332
Hello, nicehand90210 & welcome to LQ.

That GPG system uses two keys
  • A private key which you don't share with anybody.
  • A 'public' key which you share only with those who you allow to decrypt your messages

There's a utility for creating the keys. Read the documentation.
 
Old 03-24-2024, 01:21 PM   #3
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 786

Rep: Reputation: 250Reputation: 250Reputation: 250
Arrow

Make sure you're using the correct version of GPG. There's two major ones: 1 and the newer version 2. The link to "gpg" might give you either. If you don't have a key pair, make one. It seems like you do.

The public key you send out:
Code:
gpg2 --export -a you@your.host.net
Test GPG to yourself to make sure you can sign, encrypt and decrypt properly:
Code:
gpg2 -u you@your.host.net -r you@your.host.net -a --encrypt --sign file.txt
That should ask for your key password and create file.txt.asc. Check you can decrypt it with:
Code:
gpg2 -d file.txt.asc
If this part doesn't work, there's no point in going further. Fix what went wrong first before involving a second party. The -u parameter is in case you have multiple key pairs. On the other end, the person sending to you need set "-r you@your.host.net" to encrypt to you. If decryption is failing, they (the remote party) might not have encrypted to the right key.

GPG is kind of complex (in my opinion the reason it never really caught on outside of techies); you'd do well to spend some time reading a tutorial on it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] gpg Keeps asking "need the secret key to do this" gentisle Other *NIX 7 03-11-2024 10:23 PM
gpg/gpg2 encrypted for multiple recipients BUT only one key accepted for decryption? jtwdyp Linux - General 0 07-24-2015 01:44 AM
gpg: decryption failed: secret key not available edhe1 Linux - Security 4 03-08-2011 06:07 PM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM
GPG Data, Secret Key but no Public Key? Aeiri Linux - Software 5 07-20-2004 06:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration