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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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/
Example:
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);