From 7345e79eecce78ff172612aa0543923af23a435c Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 3 Jan 2020 21:30:01 +0100 Subject: [PATCH] Fixed expected private key length --- Ed25519/Signer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ed25519/Signer.cs b/Ed25519/Signer.cs index aa85ea0..82adeff 100644 --- a/Ed25519/Signer.cs +++ b/Ed25519/Signer.cs @@ -10,8 +10,8 @@ namespace Ed25519 { public static ReadOnlySpan Sign(ReadOnlySpan message, ReadOnlySpan privateKey, ReadOnlySpan 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}.");