このコードを使用してテキストの入力と出力を指定するにはどうすればよいですか?ファイルを開いてその内容を読み取り(その方法を知っています)、このコードを使用して復号化する必要があります。
public string DecryptUsernamePassword(string cipherText)
{
if (string.IsNullOrEmpty(cipherText))
{
return cipherText;
}
byte[] salt = new byte[]
{
(byte)0xc7,
(byte)0x73,
(byte)0x21,
(byte)0x8c,
(byte)0x7e,
(byte)0xc8,
(byte)0xee,
(byte)0x99
};
PKCSKeyGenerator crypto = new PKCSKeyGenerator("PASSWORD HERE", salt, 20, 1);
ICryptoTransform cryptoTransform = crypto.Decryptor;
byte[] cipherBytes = System.Convert.FromBase64String(cipherText);
byte[] clearBytes = cryptoTransform.TransformFinalBlock(cipherBytes, 0, cipherBytes.Length);
return Encoding.UTF8.GetString(clearBytes);
}
cipherTextは暗号化されたテキストであり、clearBytesは暗号化されていないバイトですが、入力と出力にC#形式のtextBoxを使用する必要があります。
textBox1.Text(入力)->バイト-> ^ above^文字列->バイト->textBox2.Text(出力)入力が暗号化されたテキストであり、出力が復号化されている限り、何でも機能します。文章。