本文整理汇总了C#中System.Security.Cryptography.Aes.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Aes.Clear方法的具体用法?C# Aes.Clear怎么用?C# Aes.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.Aes
的用法示例。
在下文中一共展示了Aes.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestClear
public static bool TestClear(Aes aes)
{
byte[] key = aes.Key;
byte[] IV = aes.IV;
try
{
aes.Clear();
// AESCSP will throw an ObjectDisposedException after class is used after Clear is called. This is reasonable behavior even though
// it's different than DESCSP, etc. If the class is still usable (ie the managed version) then make sure the key and IV are not
// the same.
//
if (CompareBytes(aes.Key, key))
{
Console.WriteLine("Error - key not reset after Clear");
return false;
}
if (CompareBytes(aes.IV, IV))
{
Console.WriteLine("Error - IV not reset after Clear");
return false;
}
}
catch (ObjectDisposedException)
{
}
return true;
}