protected bool ValidateNonce(byte[] nonce)
{
// no nonce needed for no security.
if (SecurityMode == MessageSecurityMode.None)
{
return true;
}
// check the length.
if (nonce == null || nonce.Length < GetNonceLength())
{
return false;
}
// try to catch programming errors by rejecting nonces with all zeros.
for (int ii = 0; ii < nonce.Length; ii++)
{
if (nonce[ii] != 0)
{
return true;
}
}
return false;
}