From ceef5a5620268d5236d91d507075a86d7c13356a Mon Sep 17 00:00:00 2001 From: Hayden B Date: Tue, 12 Sep 2023 15:02:32 -0700 Subject: [PATCH] Add type of ed25519 key for TUF (#1677) Without this, MarshalPublicKeyToDER returns an error since the type of the key is []uint8 rather than ed25519.PublicKey. Signed-off-by: Hayden Blauzvern --- pkg/pki/tuf/tuf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/pki/tuf/tuf.go b/pkg/pki/tuf/tuf.go index 61f34def4..f2983481d 100644 --- a/pkg/pki/tuf/tuf.go +++ b/pkg/pki/tuf/tuf.go @@ -16,6 +16,7 @@ package tuf import ( + "crypto/ed25519" "crypto/sha256" "crypto/x509" "encoding/hex" @@ -210,7 +211,7 @@ func (k PublicKey) Identities() ([]identity.Identity, error) { }) case data.KeyTypeEd25519: // key is stored as a 32-byte string - pub := []byte(verifier.Public()) + pub := ed25519.PublicKey(verifier.Public()) pkixKey, err := cryptoutils.MarshalPublicKeyToDER(pub) if err != nil { return nil, err