Skip to content

Commit

Permalink
get rid of ValidateAndUnpackCertWithCertPools
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry S <dsavints@gmail.com>
  • Loading branch information
dmitris committed Feb 14, 2024
1 parent eaaafe0 commit 44e0ff5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 4 additions & 1 deletion cmd/cosign/cli/verify/verify.go
Expand Up @@ -293,7 +293,10 @@ func (c *VerifyCommand) Exec(ctx context.Context, images []string) (err error) {
return err
}
} else {
pubKey, err = cosign.ValidateAndUnpackCertWithCertPools(cert, co)
if co.RootCerts == nil {
return errors.New("no CA roots provided to validate certificate")
}
pubKey, err = cosign.ValidateAndUnpackCert(cert, co)
if err != nil {
return err
}
Expand Down
10 changes: 0 additions & 10 deletions pkg/cosign/verify.go
Expand Up @@ -432,16 +432,6 @@ func ValidateAndUnpackCertWithChain(cert *x509.Certificate, chain []*x509.Certif
return ValidateAndUnpackCert(cert, co)
}

// ValidateAndUnpackCertWithCertPools creates a Verifier from a certificate. Verifies that the certificate
// chains up to the provided root. CheckOpts should contain a pool of CA Roots and optionally the Intermediates.
// Optionally verifies the subject and issuer of the certificate.
func ValidateAndUnpackCertWithCertPools(cert *x509.Certificate, co *CheckOpts) (signature.Verifier, error) {
if co.RootCerts == nil {
return nil, errors.New("no CA roots provided to validate certificate")
}
return ValidateAndUnpackCert(cert, co)
}

func tlogValidateEntry(ctx context.Context, client *client.Rekor, rekorPubKeys *TrustedTransparencyLogPubKeys,
sig oci.Signature, pem []byte) (*models.LogEntryAnon, error) {
b64sig, err := sig.Base64Signature()
Expand Down

0 comments on commit 44e0ff5

Please sign in to comment.