Error:gpg: decryption failed: secret key not available

I have installed new version of Gnupg(gpg4win).While decrypting i am facing error secret key not available.Please anybody can help me here.

Error.PNG

Hello Monika,

are u sure u have the secret key on your machine? have you installed kleopatra ? can you see your certificate you created?

Nishant.

I am new to GnuPG.I have installed on my system following steps from gpg4win-compendium-en-3.0.0.pdf.I have generated the key and created certificate as well.

But problem is still there.

Hi Monika,

Have you exported your secret keys to a file? i think for gpg to work you need to export your secret keys (right click on the certificate and click export keys) and save the file to your computer.

try to then decrypt the file and it should work.

Nishant.

Hi Nishant,

yes i have already exported the secret key.
But no luck.

And how are you trying to decrypt the file? commands or from Kelopatra? a screenshot or error code can be useful here.

Nishant.

If you have already created a key pair (secret/public) then they are already on your key ring. Once you encrypt a file (or anyone encrypts a file) with your public key it cannot be read unless you use the secret key. Generally, you only export the public key to give to someone else so they can encrypt a file and send to you (even they can’t read it once it is encrypted as only you have the secret key). What are you trying to do? Also, you will need your passphrase that you created when the key pair was created.

Sorry, after reading further up the chain, it looks like you need to import the secret key back onto your key ring or find the old keyring location and copy the file to the new key ring location. This location can be different depending on what version of Windows you are using. Try C:\Users\your user name\AppData\roaming\gnupg or something similar to find the pubring.gpg file. See if you have that file in more than one folder. If you find 2 files make a backup copy before replacing any files with the other

I trying with command.

Please find the screenshot as attachment.

Errror_No_secret_key.PNG

Hello Monika,

  1. did you try what chris suggested? did you see your keyring file ? if you don’t see your keyring file you need to have it in the proper folder first.

  2. what is the owner trust set to in your certificate details?

can you try below command.

  1. gpg2.exe -k - do you see your keyring list. a min of 3 value should be listed here (3 parts of 1 key)

try to decrypt your file using the below command. the output will be in the source directory of the encrypted file.

gpg2.exe --batch --passphrase “your passphrase without the quote” -d “c:*.gpg”

I have tried all steps.when i create a encryted file from my system and then decrypt it then it works.
But if i am trying to decrypt others file then its working.

Hi Monika,

Im sorry to ask but have you imported the person’s public key into Kleopatra??? the person who is encrypting should send you his public key and only then will you be able to decrypt the file.

can you post the output of gpg2.exe -k

When i use gpg --list-keys its shows in the list.
But i use the command to gpg --output 943826-D11044_2124765_635.XML --decrypt 943826-D11044_2124765_635.XML command to decrypt then it show message:

C:\GnuPG>gpg --output 943826-D11044_2124765_635.XML --decrypt 943826-D11044_2124765_635.XML
gpg: encrypted with 1024-bit ELG key, ID 3FFE2FFA, created 2002-01-31
“myeflow (Myeflow-asiakkaiden pgp-avain)”
gpg: decryption failed: No secret key

Please share the output of gpg --list-keys. also, is it possible to share the file if it is not confidential?

Nishant Shah said: " the person who is encrypting should send you his public key and only then will you be able to decrypt the file."

It is the other way around. You send the person who is encrypting your public key and then you can decrypt the file with your secret key after that person has encrypted it with your public key. If they want you to encrypt and send them a file then they need to send you their public key and you need to import it onto your keyring so you can encrypt for them (even you won’t be able to decrypt anything encrypted with their public key).

Hi Greg,

thanks for correcting the typo and apologies for addressing you as chris.

Please find the lists key screenshot as attachment.

Lists_key.PNG