예제 #1
0
 public static bool VerifyHmacSha512(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 != 64)
     {
         throw new SignatureOutOfRangeException("signature", (signature == null) ? 0 : signature.Length, string.Format("signature must be {0} bytes in length.", 64));
     }
     return(SodiumLibrary.crypto_auth_hmacsha512_verify(signature, message, (long)message.Length, key) == 0);
 }