title: gpg: public key decryption failed: Bad passphrase
body: <p>I'm trying to decrypt a file using GPG, for which I use "Starksoft.Cryptography.OpenPGP". I'm getting the following error</p>
  
  <pre><code>Starksoft.Cryptography.OpenPGP.GnuPGException: An error occurred while trying to execute command --list-secret-keys.
  </code></pre>
  
  <p>But when I execute the command through command prompt ">gpg --list-secret-keys", it does list the keys. I could not get "Starksoft.Cryptography.OpenPGP" to work correctly. </p>
  
  <p>Next I tried to get a solution by running the process directly using cmd.exe. None of the following commands is working however:</p>
  
  <pre><code>&gt;echo gpg --passphrase Mypasspharse -o "C:\successtest.txt" -d "C:\testfile.txt.gpg"
  
  &gt;echo Mypasspharse|gpg.exe --passphrase-fd 0 -o "C:\successtest.txt" --decrypt "C:\testfile.txt.gpg"
  
  &gt;echo Mypasspharse|gpg --keyring "pubring.gpg location" --secret-keyring "secring.gpg location" --batch --yes --passphrase-fd 0 -o "C:\successtest.txt" -d "C:\testfile.txt.gpg"
  
  
  &gt;echo Mypasspharse|gpg -o C:\successtest.txt --batch --passphrase-fd 0 --decrypt C:\testfile.txt.gpg
  
  
   &gt;echo Mypasspharse|gpg2 --batch --passphrase-file "PrivateKey.asc location" --output C:\successtest.txt --decrypt C:\testfile.txt.gpg
  
  Error Message : gpg: public key decryption failed: Bad passphrase
                  gpg: decryption failed: No secret key
  </code></pre>
  
  <p>Can anybody show me how to decrypt the file?</p>