LinuxQuestions.org
Visit Jeremy's Blog.
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 10-10-2011, 11:00 AM   #1
learn.dw29
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
decrypt pgp file using gpg and passphrase


Hi,
I'm trying to decrypt a file received from external source and i would like to know all the steps that i need to setup for decrypting the file. I tried couple of ways but it keeps asking about secret key not available.

gpg --output "/tmp/xxx.txt" --decrypt "/tmp/xxx.pgp"
gpg: encrypted with ELG-E key, ID 98F004C9
gpg: decryption failed: secret key not available

and if i try to use different option where in I pass passphrase i got i still get same error.

echo pphrase|gpg --passphrase-fd 0 --always-trust --batch --yes --quiet --output "/tmp/xxx.txt" --decrypt "/tmp/xxx.pgp"
gpg: decryption failed: secret key not available

Could you all please tell what kind of setup i need to make for this to work. Do I need to install some kind of key ring in some directory. If so in which directory should i install? in my home directory or in some common place which is accessible to all users. And finally what is the key.I went through some documentation online and could not get to the point.

What all should I need when i receive a encrypted file from someone and all the setup that I need to make on my server.

Thanks.
 
Old 10-10-2011, 01:31 PM   #2
Ian John Locke II
Member
 
Registered: Mar 2008
Location: /dev/null
Distribution: Slackware, Android, Slackware64
Posts: 130

Rep: Reputation: 17
I only recently (a few days ago) started diving into pgp/gpg. It seems to me, and I could be wrong, that when someone encrypts a file/message to send to you, they need to use your public key to encrypt it. Your public key is generated from your private key. To have a key in the first place you need to run
Code:
gpg --gen-key
This link should help though: http://www.spywarewarrior.com/uiuc/g...com-4.htm#4-1d

--
Edit
Also the output of your original command tells you that it was encrypted with ElGamal and gives you the key's ID.
If you know which keyserver (if any) the person used, you can use
Code:
gpg --keyserver keyserver.example.com --recv-key 98F004C9
To get their key. It may be that they encrypted it in such a way that you can decrypt it.

Last edited by Ian John Locke II; 10-10-2011 at 01:37 PM. Reason: Add more helpful information
 
Old 10-10-2011, 01:50 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Ian John Locke II is correct in that files need to be encrypted with your (the recipient) key, not the sender's key. Files can be encrypted with a public key, which one normally publishes on key servers after generating it. File encrypted with the public key can only be decrypted with the private key. Using the recv-key command as shown above will obtain the public key, which can be used to send to that recipient, but unless that is your private key, you won't be able to decrypt anything encoded with 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
file descriptors in Perl-----I need to use gpg's "--passphrase-fd n" option Rain Duck Programming 5 02-25-2011 09:52 AM
Can't decrypt anything with GPG Jorophose Linux - Security 2 12-06-2007 04:57 PM
Cracking a gpg pgp key (passphrase) DaRkBoDoM Linux - Security 1 11-20-2007 03:32 AM
Can't decrypt a file; Pgp error Msg. follows drmjh Linux - Newbie 7 05-17-2007 01:48 PM
KMail and PGP/GPG not working - doesn't ask for passphrase steve1401 Linux - General 2 02-08-2005 06:42 AM

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

All times are GMT -5. The time now is 03:55 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