Reputation: 79
anybody knows how to change @"C:\Test\public_key.asc"
from manually input to using openfiledialog?
I tried to do that, there is this red zizag line under the code and when i put my mouse over, it says that it cannot convert System.IO.FileInfo to 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);
}
}
The below does not help us well because it does not open a dialog box for me to choose my file.
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);
}
Upvotes: 0
Views: 514
Reputation: 1464
Have you tried with:
bool asciiArmor = false;
bool withIntegrityCheck = false;
pgp.EncryptFile(@attachmentTextBox.Text, openFileDialog1.FileName, @"C:\OUTPUT.pgp", asciiArmor, withIntegrityCheck);
Upvotes: 1