本文整理汇总了C#中MonoTests.System.Security.Cryptography.DebugStream.Read方法的典型用法代码示例。如果您正苦于以下问题:C# DebugStream.Read方法的具体用法?C# DebugStream.Read怎么用?C# DebugStream.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoTests.System.Security.Cryptography.DebugStream
的用法示例。
在下文中一共展示了DebugStream.Read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NonMultipleOfBlockSize_Encrypt
// Adapted from Subba Rao Thirumoorthy email on mono-devel-list (december 2003)
private byte[] NonMultipleOfBlockSize_Encrypt (ICryptoTransform ct, byte[] data)
{
DebugStream stream = new DebugStream ();
CryptoStream CryptStream = new CryptoStream (stream, ct, CryptoStreamMode.Write);
int len = 0;
long myLength = 0;
byte[] Buffer = new byte [1024];
DebugStream fout = new DebugStream (data);
while (myLength < data.Length) {
len = fout.Read (Buffer, 0, 1023);
if (len == 0)
break;
CryptStream.Write (Buffer, 0, len);
CryptStream.Flush ();
myLength = myLength + len;
}
CryptStream.FlushFinalBlock ();
// we must ensure that the result is correct
Assert.AreEqual (64, len, "Length(final)");
byte[] result = stream.ToArray ();
string end = BitConverter.ToString (result, 65520, 16);
Assert.AreEqual ("04-70-19-1D-28-C5-BD-9A-23-C6-60-E2-28-96-38-65", end, "End part");
CryptStream.Close();
stream.Close();
return result;
}