pgp passphrase using command line

How can I retrieve a pgp passphrase using command line? I am trying to decrypt a file but keep getting this error. “no private key could be found for decryption.”
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

btanExec ConsultantCommented:
PLs see this if hepful

Most likely, the file wasn't encrypted to a key you possess.

If you run "pgp --list-keys" it will show you all the keys in your keyring.  Some of these are your prviate keys, and the others are the public keys of people you communicate with.

Run "pgp --verify file-to-verify" and it will tell you the KeyID of the recipient key.  The file should be encrypted to an encryption subkey.  You'll see a message like

file.pgp:verify (3144:data is encrypted to unknown ID 0x73357D11)
file.pgp:verify (1080:no private key could be found for decryption)

in which case you have no idea to whom the file was actually encrypted.  Or, you might see something like

file.pgp:verify (3093:data is encrypted to subkey ID 0x73357D11)
file.pgp:verify (3044:subkey ID 0x73357D11 belongs to 0xCF73E89C Jon Test <>)
file.pgp:verify (1080:no private key could be found for decryption)
This tells you that you at least have the corresponding public key in your keyring.
TSG954Author Commented:
Thanks, getting this after the 'verify file' command. What does this mean?

C:\Documents and Settings\STEVE\Desktop>pgp --verify ws_test.txt.pgp
ws_test.txt.pgp:verify (3093:data is encrypted to subkey ID 0x4941B758)
ws_test.txt.pgp:verify (3044:subkey ID 0x4941B758 belongs to 0x26795D0E whateverWW
XXUNIT Mainframe PGP <>)
ws_test.txt.pgp:verify (1080:no private key could be found for decryption)
btanExec ConsultantCommented:
It is meant to say the pgp private key belongs to a user ID:
- whateverWWXXUNIT Mainframe PGP <>

you can run the pgp --list-keys [<user1> ...] Where: <user1> is the user ID, portion of a user ID, or the key ID of a key on your keyring. Example of output if not user id is specified, you will see the whole list of user id existing in the machine like below. If you do not see the user id as above then the pgp verify will fail

e.g. pgp --list-keys - Lists all of the keys on your keyrings using the format:

Alg Type Size/Type Flags Key ID User ID
--- ---- --------- ------- ---------- ------------------------
DSS pub 2048/1024 [-----] 0xABCD1234 Alice C <>

Likewise you can try running pgp -l 0x12345678 where it lists only the key with the specified key ID, if it is on the keyring..

Suggest uyou check the user guide which is quite comprehensive.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TSG954Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.