私は以下のコードを持っています:
private void encryptFileButton_Click(object sender, EventArgs e)
{
try
{
bool asciiArmor = false;
bool withIntegrityCheck = false;
pgp.EncryptFile(@attachmentTextBox.Text,
@"C:\TCkeyPublic.txt",
@"C:\OUTPUT.pgp",
asciiArmor,
withIntegrityCheck);
MessageBox.Show("File Encrypted Successfully!");
}
catch
{
MessageBox.Show("File Encryption Fail!");
}
}
@"C:\TCkeyPublic.txt"
のようなものに変えたいnew FileInfo(openFileDialog1.FileName)
。そのため、ユーザーは、ファイル名またはファイル パスが異なる場合に常にコードを変更する必要はありません。
しかし、それをしようとすると、コードの下にこの赤いジザグ線があり、マウスを上に置くと、System.IO.FileInfo を System.IO.Stream に変換できないと表示されます。
try
{
bool asciiArmor = false;
bool withIntegrityCheck = false;
pgp.EncryptFile(@attachmentTextBox.Text,
new FileInfo(openFileDialog1.FileName),
@"C:\OUTPUT.pgp",
asciiArmor,
withIntegrityCheck);
MessageBox.Show("File Encrypted Successfully!");
}
catch
{
MessageBox.Show("File Encryption Fail!");
}
私はdidisoft pgp(BouncyCastle.CryptoExt.dllおよびDidiSoft.Pgp.dll)を使用して、PGP公開鍵を使用してファイルを暗号化するためにPGPを使用するプロジェクトを構築し、パスフレーズと秘密鍵を使用してそれを復号化しています。
親切にアドバイス!!!ありがとう!