首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DIDISOFT PGP文件加密

DIDISOFT PGP文件加密
EN

Stack Overflow用户
提问于 2013-10-30 21:22:45
回答 1查看 376关注 0票数 0

有人知道如何将@"C:\Test\public_key.asc"从手动输入改为使用openfiledialog吗?

我试着这样做,在代码下面有一条红色的zizag线,当我把鼠标放在上面时,它告诉我无法将System.IO.FileInfo转换为System.IO.Stream。

代码语言:javascript
复制
using System.IO;
using DidiSoft.Pgp;

class EncryptDemo {
 public void Demo() {
     // create an instance of the library
     PGPLib pgp = new PGPLib();

     // specify should the output be ASCII or binary
     bool asciiArmor = false;
     // should additional integrity information be added
     // set to false for compatibility with older versions of PGP such as 6.5.8.
     bool withIntegrityCheck = false;

     pgp.EncryptFile(@"C:\Test\INPUT.txt",
                     @"C:\Test\public_key.asc",
                     @"C:\Test\OUTPUT.pgp",
                     asciiArmor,
                     withIntegrityCheck);
 }
}

下面对我们没有很好的帮助,因为它没有打开一个对话框,让我选择我的文件。

代码语言:javascript
复制
    bool asciiArmor = false;
    bool withIntegrityCheck = false;
    using (var publickey = new FileStream(openFileDialog1.FileName, FileMode.Open))
    {
        pgp.EncryptFile(@attachmentTextBox.Text, publickey, @"C:\OUTPUT.pgp", asciiArmor, withIntegrityCheck);
    }
EN

回答 1

Stack Overflow用户

发布于 2013-11-17 03:26:47

你有没有尝试过:

代码语言:javascript
复制
bool asciiArmor = false;
bool withIntegrityCheck = false;
pgp.EncryptFile(@attachmentTextBox.Text, openFileDialog1.FileName, @"C:\OUTPUT.pgp", asciiArmor, withIntegrityCheck);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19683456

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档