public static bool Verify(byte[] signature, byte[] message, byte[] publicKey) { if (signature == null) { throw new ArgumentNullException(nameof(signature)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } if (publicKey == null) { throw new ArgumentNullException(nameof(publicKey)); } if (signature.Length != SignatureSizeInBytes) { throw new ArgumentException($"Signature size must be {SignatureSizeInBytes}", nameof(signature)); } if (publicKey.Length != PublicKeySizeInBytes) { throw new ArgumentException($"Public key size must be {PublicKeySizeInBytes}", nameof(signature)); } return(Ed25519Operations.CryptoSignVerify(signature, 0, message, 0, message.Length, publicKey, 0)); }
/// <summary> /// Verify Ed25519 signature /// </summary> /// <param name="signature"> /// Signature bytes /// </param> /// <param name="message"> /// Message /// </param> /// <param name="publicKey"> /// Public key /// </param> /// <returns> /// True if signature is valid, false if it's not /// </returns> public static bool Verify(byte[] signature, byte[] message, byte[] publicKey) { return(Ed25519Operations.CryptoSignVerify(signature, 0, message, 0, message.Length, publicKey, 0)); }
/// <summary> /// Verify Ed25519 signature /// </summary> /// <param name="signature"> /// Signature bytes /// </param> /// <param name="message"> /// Message /// </param> /// <param name="publicKey"> /// Public key /// </param> /// <returns> /// True if signature is valid, false if it's not /// </returns> public static bool Verify(ArraySegment <byte> signature, ArraySegment <byte> message, ArraySegment <byte> publicKey) { return(Ed25519Operations.CryptoSignVerify(signature.Array, signature.Offset, message.Array, message.Offset, message.Count, publicKey.Array, publicKey.Offset)); }