有人知道我的代码有什么问题吗?
我在下面这行继续收到错误:
bool validSignature = pgp.VerifyString(verifyRichTextBox.Text, new FileInfo(openFileDialog1.FileName), out plainText);
错误是路径不合法路径。
以下是完整代码:
public void verifyAll()
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Title = "PLEASE CHOOSE SENDER'S PUBLIC KEY";
string plainText;
bool validSignature = pgp.VerifyString(verifyRichTextBox.Text, new FileInfo(openFileDialog1.FileName), out plainText);
if (validSignature == true)
verifyRichTextBox.Text = "Signature is valid!\n\n" + plainText;
else
MessageBox.Show("Signature is invalid!", "Invalid Signature", MessageBoxButtons.OK ,MessageBoxIcon.Exclamation);
}
这是一个公钥/私钥签名和验证程序。此部分是签名消息的验证部分。一切都使用了didisoft OpenPGP。
答案 0 :(得分:1)
我认为您的OpenFileDialog尚未执行。您可以像这样修改代码:
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string plainText;
bool validSignature = pgp.VerifyString(verifyRichTextBox.Text, new FileInfo(openFileDialog1.FileName), out plainText);
if (validSignature == true)
verifyRichTextBox.Text = "Signature is valid!\n\n" + plainText;
else
MessageBox.Show("Signature is invalid!", "Invalid Signature", MessageBoxButtons.OK ,MessageBoxIcon.Exclamation);
}
您也可以使用我们提到的官方联系方式直接与我们联系 http://www.didisoft.com/support/