使用C#的GnuPG包装器 [英] GnuPG Wrapper with C#

查看:34
本文介绍了使用C#的GnuPG包装器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

您可以尝试使用针对C#(和VB.NET)的开放源代码和免费的GnuPG包装器.所有代码均通过MIT(非GPL限制)进行许可.您可以在CodePlex上找到包含源代码的发行版.寻找Alpha版本以找到GPG库.

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 at CodePlex. Look for the Alpha release to find the GPG library.

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);

这篇关于使用C#的GnuPG包装器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆