From b41aa632ca2969ca830dce29af28a96b9fea7085 Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Wed, 19 Apr 2023 17:25:16 -0600 Subject: [PATCH] update error messages Signed-off-by: Meredith Lancaster --- pkg/signer/file.go | 2 +- pkg/signer/memory.go | 2 +- pkg/signer/tink.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/signer/file.go b/pkg/signer/file.go index 62c6b093..25d6a5d9 100644 --- a/pkg/signer/file.go +++ b/pkg/signer/file.go @@ -51,7 +51,7 @@ func NewFileSigner(keyPath, keyPass string, hashFunc crypto.Hash) (*File, error) return &File{signer}, nil case ed25519.PrivateKey: if hashFunc != crypto.SHA512 { - fmt.Printf("ed25519 only supports SHA512, specified hash func is %s. Using SHA512\n", hashFunc) + fmt.Printf("Ed25519 only supports SHA512, specified hash func is %s. Using hash function specified by Ed25519\n", hashFunc) } signer, err := signature.LoadED25519SignerVerifier(pk) if err != nil { diff --git a/pkg/signer/memory.go b/pkg/signer/memory.go index 5f59175c..250bdb14 100644 --- a/pkg/signer/memory.go +++ b/pkg/signer/memory.go @@ -34,7 +34,7 @@ func getCurveFromSigner(signer crypto.Signer) (elliptic.Curve, error) { // the in-memory cert chain uses ECDSA keys, so we cast the public key to an ECDSA key pub, ok := signer.Public().(*ecdsa.PublicKey) if !ok { - return nil, errors.New("signer is not an ECDSA key") + return nil, errors.New("casting signer's public key to an ECDSA key") } return pub.Curve, nil } diff --git a/pkg/signer/tink.go b/pkg/signer/tink.go index 49d667ee..2055e595 100644 --- a/pkg/signer/tink.go +++ b/pkg/signer/tink.go @@ -130,7 +130,7 @@ func KeyHandleToSigner(kh *keyset.Handle, hashFunc crypto.Hash) (crypto.Signer, return p, nil case ed25519SignerTypeURL: if hashFunc != crypto.SHA512 { - fmt.Printf("ed25519 only supports SHA512, specified hash func is %s. Using SHA512\n", hashFunc) + fmt.Printf("Ed25519 only supports SHA512, specified hash func is %s. Using hash function specified by Ed25519\n", hashFunc) } // https://github.com/google/tink/blob/9753ffddd4d04aa56e0605ff4a0db46f2fb80529/go/signature/ed25519_signer_key_manager.go#L47 privKey := new(ed25519pb.Ed25519PrivateKey)