ファイルを復号化するとエラーが発生します。「道は法的な形式ではない」
たとえば、string privateKeyLocation = @"c:\privatekey.txt" など、privateKeyLocation を手動で指定すると、問題なく動作します。
しかし、ファイルを開くダイアログを使用して自分でキーファイルを見つけたいです。誰が何がうまくいかなかったのか知っていますか?前もって感謝します!
private void decryptFileButton_Click(object sender, EventArgs e)
{
string inputFileLocation = attachmentTextBox.Text;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.RestoreDirectory = true;
string privateKeyLocation = new FileInfo(openFileDialog1.FileName).ToString();
string privateKeyPassword = passphrase2TextBox.Text;
string outputFile = @"c:\Original.txt";
// decrypt and obtain the original file name
// of the decrypted file
string originalFileName =
pgp.DecryptFile(inputFileLocation,
privateKeyLocation,
privateKeyPassword,
outputFile);
}