0
votes

I am trying to encrypt using gpg but i get this error even though i have given the path explicitly.. can some one help me? I am using Starksoft.Cryptography.OpenPGP. I have installed the gpg4win-light-2.1.0.exe to obtain the gpg.exe file..

is there something i am missing?

Error:GPG executable not found. @C:\Program Files\GNU\GnuPG\gpg.exe\gpg2.exe.

        GnuPG gpg = new GnuPG();
        gpg.BinaryPath = "@C:\\Program Files\\GNU\\GnuPG\\gpg.exe";
        gpg.Recipient = "[email protected]";
        FileStream sourceFile = new FileStream(sourcePath, FileMode.Open);
        FileStream outputFile = new FileStream(Destinationpath, FileMode.Create);
        gpg.Encrypt(sourceFile,outputFile);
        sourceFile.Close();
        outputFile.Close();

I even have a licence for openBlackboxPGP.. can i encrypt using gpg using that??

Please help me if i am missing something! Thanks in advance!

1
(Changed from a comment to an answer, see below.)David R Tribble

1 Answers

0
votes

I think you meant to say

gpg.BinaryPath = @"C:\Program Files\GNU\GnuPG\gpg.exe";

(note the placement of the @), or

gpg.BinaryPath = "C:\\Program Files\\GNU\\GnuPG\\gpg.exe";

although you are probably better off using the more readable form

gpg.BinaryPath = "C:/Program Files/GNU/GnuPG/gpg.exe";