예제 #1
0
 public static bool Verify(byte[] message, byte[] signature, byte[] key)
 {
     if (key == null || key.Length != 32)
     {
         throw new KeyOutOfRangeException("key", (key == null) ? 0 : key.Length, string.Format("key must be {0} bytes in length.", 32));
     }
     if (signature == null || signature.Length != 16)
     {
         throw new SignatureOutOfRangeException("signature", (signature == null) ? 0 : signature.Length, string.Format("signature must be {0} bytes in length.", 16));
     }
     return(SodiumLibrary.crypto_onetimeauth_verify(signature, message, (long)message.Length, key) == 0);
 }