2022-08-15 23:55:44 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Org.BouncyCastle.Crypto
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class Check
|
|
|
|
|
|
{
|
|
|
|
|
|
internal static void DataLength(bool condition, string msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (condition)
|
|
|
|
|
|
throw new DataLengthException(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static void DataLength(byte[] buf, int off, int len, string msg)
|
|
|
|
|
|
{
|
2022-08-25 21:29:33 +08:00
|
|
|
|
if (off > (buf.Length - len))
|
2022-08-15 23:55:44 +08:00
|
|
|
|
throw new DataLengthException(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static void OutputLength(byte[] buf, int off, int len, string msg)
|
|
|
|
|
|
{
|
2022-08-25 21:29:33 +08:00
|
|
|
|
if (off > (buf.Length - len))
|
2022-08-15 23:55:44 +08:00
|
|
|
|
throw new OutputLengthException(msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|