tags:

views:

1065

answers:

1

Hi. I use GnuPG and C# to encrypt files with imported public keys. But when I try to make encryption, GnuPG encrypt file with public key of main user. I'm sure that I pass right recipient. Any help is appreciated. Thanks.

+6  A: 

You can try using my open source and free GnuPG wrapper for C# (and VB.NET). All the code is licensed via MIT, non-GPL restrictions. You can find the release with source code on Sourceforge.net.

http://sourceforge.net/projects/starksoftopenpg/

You can also find the latest and other component on my web site www.starksoft.com. Enjoy!

-Benton

Example:

  GnuPG gpg = new GnuPG();

  gpg.Recipient = "[email protected]";
  FileStream sourceFile = new FileStream(@"c:\temp\source.txt", FileMode.Open); 
  FileStream outputFile = new FileStream(@"c:\temp\output.txt", FileMode.Create);

  // encrypt the data using IO Streams - any type of input and output IO Stream can be used
  gpg.Encrypt(sourceFile, outputFile);
Benton Stark