From 5395644619c6571ba62443c1e4b4be35375b63fe Mon Sep 17 00:00:00 2001 From: Hayden Blauzvern Date: Tue, 12 Sep 2023 21:40:12 +0000 Subject: [PATCH] Add type of ed25519 key for TUF 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