When I try to decrypt a file using GPG, for which I use "Starksoft.Cryptography.OpenPGP". I got the following error
Starksoft.Cryptography.OpenPGP.GnuPGException: An error occurred while trying to execute command --list-secret-keys.
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.
Next I tried to get a solution by running the process directly using cmd.exe, which worked perfectly.
>echo Mypasspharse|gpg.exe --passphrase-fd 0 -o "C:\successtest.txt" --decrypt "C:\testfile.txt.gpg"
Note:
If Mypassphare contain a character ">" which will get interpreted as std out redirect in windows command prompt. So, passphase will not pass to the next command properly. So make sure you are not using ">" in Passphase, if you are planning to use command prompt for gpg decryption
No comments:
Post a Comment
Please include your thoughts/suggestion to make it as a better blog. If you find it useful, Please update with your valuable comments, so that others can use it.