C# Programming
07-10-2009, 07:12 PM
Help.
Has anyone managed to get GnuPG working from C#?
I have installed the latest version of GnuPG and downloaded the wrapper GnuPGWrapper from this site.
I've created a new registry key called HomeDir in HKEY_CURRENT_USER\Software\GNU\GnuPG with a value
of "C:\Program Files\GNU\GnuPG\" the gpg.exe and keyring files are also in this ********.
When I run my simple console application I get this error.
"Emmanuel.Cryptography.GnuPG.GnuPGException was unhandled
Message="gpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\secring.gpg': file open error\r\ngpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\pubring.gpg': file open error\r\ngpg: no valid OpenPGP data found.\r\ngpg: processing message failed: eof\r\n"
"
Has anyone got a working example of this that they would be kind enough to post as I've now pulled all my hair out http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif
My console application looks like this..
using System;
using Emmanuel.Cryptography.GnuPG;
namespace FileSystemExample
{
class FileExample
{
public static void Main()
{
string inputText;
string outputText;
GnuPGWrapper gpg = new GnuPGWrapper();
gpg.command = Commands.Encrypt;
gpg.homedirectory = @"C:\Program Files\GNU\GnuPG\";
gpg.passphrase = "fred";
gpg.originator = "crypto@turpin-distribution.com";
gpg.recipient = "crypto@turpin-distribution.com";
inputText = "Hello World";
gpg.ExecuteCommand(inputText, out outputText);
Console.WriteLine("Input = {0}, Output = {1}", inputText,outputText);
}
}
}
Has anyone managed to get GnuPG working from C#?
I have installed the latest version of GnuPG and downloaded the wrapper GnuPGWrapper from this site.
I've created a new registry key called HomeDir in HKEY_CURRENT_USER\Software\GNU\GnuPG with a value
of "C:\Program Files\GNU\GnuPG\" the gpg.exe and keyring files are also in this ********.
When I run my simple console application I get this error.
"Emmanuel.Cryptography.GnuPG.GnuPGException was unhandled
Message="gpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\secring.gpg': file open error\r\ngpg: keyblock resource `C:/Program Files/GNU/GnuPG\" --yes --batch --encrypt --armor --recipient crypto@turpin-distribution.com --default-key crypto@turpin-distribution.com --passphrase-fd 0 --no-verbose \\pubring.gpg': file open error\r\ngpg: no valid OpenPGP data found.\r\ngpg: processing message failed: eof\r\n"
"
Has anyone got a working example of this that they would be kind enough to post as I've now pulled all my hair out http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif
My console application looks like this..
using System;
using Emmanuel.Cryptography.GnuPG;
namespace FileSystemExample
{
class FileExample
{
public static void Main()
{
string inputText;
string outputText;
GnuPGWrapper gpg = new GnuPGWrapper();
gpg.command = Commands.Encrypt;
gpg.homedirectory = @"C:\Program Files\GNU\GnuPG\";
gpg.passphrase = "fred";
gpg.originator = "crypto@turpin-distribution.com";
gpg.recipient = "crypto@turpin-distribution.com";
inputText = "Hello World";
gpg.ExecuteCommand(inputText, out outputText);
Console.WriteLine("Input = {0}, Output = {1}", inputText,outputText);
}
}
}