Fixed expected private key length

This commit is contained in:
Thorsten Sommer 2020-01-03 21:30:01 +01:00
parent 66ad1b8f7c
commit 7345e79eec

View File

@ -10,8 +10,8 @@ namespace Ed25519
{
public static ReadOnlySpan<byte> Sign(ReadOnlySpan<byte> message, ReadOnlySpan<byte> privateKey, ReadOnlySpan<byte> publicKey)
{
if(privateKey.Length == 0)
throw new ArgumentException("Private key length is wrong. Key must not be empty.");
if(privateKey.Length != Constants.BIT_LENGTH / 8)
throw new ArgumentException($"Private key length is wrong. Got {publicKey.Length} instead of {Constants.BIT_LENGTH / 8}.");
if (publicKey.Length != Constants.BIT_LENGTH / 8)
throw new ArgumentException($"Public key length is wrong. Got {publicKey.Length} instead of {Constants.BIT_LENGTH / 8}.");