From 32c61000a54da5a59ce2cde2c39b7a3ae3995cd8 Mon Sep 17 00:00:00 2001 From: Bohdan Kuchma Date: Mon, 6 Jan 2025 13:26:42 +0200 Subject: [PATCH] Refactor ECDSA error log --- internal/types/signature_algorithm.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/types/signature_algorithm.go b/internal/types/signature_algorithm.go index d74066f..3b9e577 100644 --- a/internal/types/signature_algorithm.go +++ b/internal/types/signature_algorithm.go @@ -71,7 +71,11 @@ func verifyECDSA(data, sig []byte, publicKey *ecdsa.PublicKey) error { case 56: index = 28 default: - return fmt.Errorf("ECDSA signature length is not 64 or 56, but %d, with key %s", len(sig), publicKey.Curve.Params().Name) + return fmt.Errorf( + "unexpected ECDSA signature length, got %d bytes for %s curve", + len(sig), + publicKey.Curve.Params().Name, + ) } r, s := new(big.Int).SetBytes(sig[:index]), new(big.Int).SetBytes(sig[index:])