From a7b15ad1f8f7332679d45b50f53979dc74453207 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 17 Feb 2022 14:33:23 +0100 Subject: [PATCH] Expose DecodePubHash --- tpm.go | 2 +- tpm_attestor.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tpm.go b/tpm.go index 4c642eb..4833112 100644 --- a/tpm.go +++ b/tpm.go @@ -60,7 +60,7 @@ func GetPubHash(opts ...Option) (string, error) { return "", fmt.Errorf("getting EK: %w", err) } - hash, err := getPubHash(ek) + hash, err := DecodePubHash(ek) if err != nil { return "", fmt.Errorf("hashing EK: %w", err) } diff --git a/tpm_attestor.go b/tpm_attestor.go index 957c601..0c50c14 100644 --- a/tpm_attestor.go +++ b/tpm_attestor.go @@ -43,7 +43,8 @@ type ChallengeResponse struct { Secret []byte } -func getPubHash(ek *attest.EK) (string, error) { +// DecodePubHash returns the public key from an attestation EK +func DecodePubHash(ek *attest.EK) (string, error) { data, err := pubBytes(ek) if err != nil { return "", err