有人知道如何将@"C:\Test\public_key.asc"从手动输入改为使用openfiledialog吗?
我试着这样做,在代码下面有一条红色的zizag线,当我把鼠标放在上面时,它告诉我无法将System.IO.FileInfo转换为System.IO.Stream。
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);
}
}下面对我们没有很好的帮助,因为它没有打开一个对话框,让我选择我的文件。
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);
}发布于 2013-11-17 03:26:47
你有没有尝试过:
bool asciiArmor = false;
bool withIntegrityCheck = false;
pgp.EncryptFile(@attachmentTextBox.Text, openFileDialog1.FileName, @"C:\OUTPUT.pgp", asciiArmor, withIntegrityCheck);https://stackoverflow.com/questions/19683456
复制相似问题