使用 C# 的 GnuPG 包装器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1214026/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GnuPG Wrapper with C#
提问by iburlakov
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.
我使用 GnuPG 和 C# 用导入的公钥加密文件。但是当我尝试进行加密时,GnuPG 使用主用户的公钥加密文件。我确定我通过了正确的收件人。
采纳答案by Benton
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.
您可以尝试将我的开源和免费 GnuPG 包装器用于 C#(和 VB.NET)。所有代码均通过 MIT 许可,非 GPL 限制。您可以在 CodePlex 上找到带有源代码的版本。查找 Alpha 版本以查找 GPG 库。
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);