Skip to content

Commit

Permalink
Use existing method on the sdk for extracting certs
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed May 17, 2024
1 parent 1be96b9 commit 997f98d
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions pkg/uki/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package uki

import (
"bytes"
"crypto/x509"
"errors"
"fmt"
"github.com/foxboron/go-uefi/efi"
"github.com/foxboron/go-uefi/efi/pecoff"
"github.com/foxboron/go-uefi/efi/pkcs7"
"github.com/foxboron/go-uefi/efi/signature"
"github.com/foxboron/go-uefi/efi/util"
"github.com/kairos-io/kairos-sdk/signatures"
"io"
"os"
"strings"
Expand Down Expand Up @@ -193,19 +193,7 @@ func checkArtifactSignatureIsValid(fs v1.FS, artifact string, logger sdkTypes.Ka
return err
}

var dbCerts []*x509.Certificate

for _, k := range *db {
if isValidDBSignature(k.SignatureType) {
for _, k1 := range k.Signatures {
// Note the S at the end of the function, we are parsing multiple certs, not just one
certs, err := x509.ParseCertificates(k1.Data)
if err == nil && len(certs) != 0 {
dbCerts = append(dbCerts, certs...)
}
}
}
}
dbCerts := signatures.ExtractCertsFromSignatureDatabase(db)

f, err := fs.ReadFile(artifact)
if err != nil {
Expand Down

0 comments on commit 997f98d

Please sign in to comment.