は、C#でEn-/Decrypterを書き込もうとしています。タイトルが示すように、私はCryptoStream.close()でSystem.Security.Cryptography.CryptographicExceptionを取得します。私はまだ解決策を見つけていない。誰もが助けることを願っています。CryptoStream.close()でC#暗号化System.Security.Cryptography.CryptographicException
public static string viaRijndael(byte[] input, string key, string iV)
{
Rijndael RijCrypt = Rijndael.Create();
RijCrypt.Key = System.Text.Encoding.UTF8.GetBytes(Tools.GetMD5Hash(Tools.GetMD5Hash(key)));
RijCrypt.IV = System.Text.Encoding.UTF8.GetBytes(Tools.GetMD5Hash(Tools.GetMD5Hash(key)).Substring(0, 16));
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, RijCrypt.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(input, 0, input.Length);
cs.Close(); // System.Security.Cryptography.CryptographicException
byte[] DecryptedBytes = ms.ToArray();
return System.Text.Encoding.UTF8.GetString(DecryptedBytes);
}
質問に例外を追加してください。 – Gusman
System.Security.Cryptography.CryptographicException –
型、メッセージ、呼び出しスタックではありません... – Gusman