Fixed expected private key length
This commit is contained in:
parent
66ad1b8f7c
commit
7345e79eec
@ -10,8 +10,8 @@ namespace Ed25519
|
|||||||
{
|
{
|
||||||
public static ReadOnlySpan<byte> Sign(ReadOnlySpan<byte> message, ReadOnlySpan<byte> privateKey, ReadOnlySpan<byte> publicKey)
|
public static ReadOnlySpan<byte> Sign(ReadOnlySpan<byte> message, ReadOnlySpan<byte> privateKey, ReadOnlySpan<byte> publicKey)
|
||||||
{
|
{
|
||||||
if(privateKey.Length == 0)
|
if(privateKey.Length != Constants.BIT_LENGTH / 8)
|
||||||
throw new ArgumentException("Private key length is wrong. Key must not be empty.");
|
throw new ArgumentException($"Private key length is wrong. Got {publicKey.Length} instead of {Constants.BIT_LENGTH / 8}.");
|
||||||
|
|
||||||
if (publicKey.Length != 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}.");
|
throw new ArgumentException($"Public key length is wrong. Got {publicKey.Length} instead of {Constants.BIT_LENGTH / 8}.");
|
||||||
|
Loading…
Reference in New Issue
Block a user