3

我使用 GnuPG 和 C# 使用导入的公钥加密文件。但是当我尝试进行加密时,GnuPG 使用主用户的公钥加密文件。我确定我通过了正确的收件人。

4

1 回答 1

12

您可以尝试使用我的 C#(和 VB.NET)的开源和免费 GnuPG 包装器。所有代码均通过 MIT 许可,非 GPL 限制。您可以在 CodePlex 找到带有源代码的版本。查找 Alpha 版本以查找 GPG 库。

http://biko.codeplex.com/

例子:

  GnuPG gpg = new GnuPG();

  gpg.Recipient = "myfriend@domain.com";
  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);
于 2009-11-29T17:44:32.137 回答