@@ -30,11 +30,9 @@ import (
3030 "github.com/sigstore/cosign/v3/internal/ui"
3131 "github.com/sigstore/cosign/v3/pkg/cosign"
3232 "github.com/sigstore/cosign/v3/pkg/cosign/cue"
33- "github.com/sigstore/cosign/v3/pkg/cosign/env"
3433 "github.com/sigstore/cosign/v3/pkg/cosign/rego"
3534 "github.com/sigstore/cosign/v3/pkg/oci"
3635 "github.com/sigstore/cosign/v3/pkg/policy"
37- "github.com/sigstore/sigstore-go/pkg/root"
3836)
3937
4038// VerifyAttestationCommand verifies a signature on a supplied container image
@@ -132,23 +130,9 @@ func (c *VerifyAttestationCommand) Exec(ctx context.Context, images []string) (e
132130 co .ClaimVerifier = cosign .IntotoSubjectClaimVerifier
133131 }
134132
135- if c .TrustedRootPath != "" {
136- if ! co .NewBundleFormat {
137- return fmt .Errorf ("unsupported: trusted root path currently only supported with --new-bundle-format" )
138- }
139- co .TrustedMaterial , err = root .NewTrustedRootFromPath (c .TrustedRootPath )
140- if err != nil {
141- return fmt .Errorf ("loading trusted root: %w" , err )
142- }
143- } else if options .NOf (c .CertChain , c .CARoots , c .CAIntermediates , c .TSACertChainPath ) == 0 &&
144- env .Getenv (env .VariableSigstoreCTLogPublicKeyFile ) == "" &&
145- env .Getenv (env .VariableSigstoreRootFile ) == "" &&
146- env .Getenv (env .VariableSigstoreRekorPublicKey ) == "" &&
147- env .Getenv (env .VariableSigstoreTSACertificateFile ) == "" {
148- co .TrustedMaterial , err = cosign .TrustedRoot ()
149- if err != nil {
150- ui .Warnf (ctx , "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v" , err )
151- }
133+ err = SetTrustedMaterial (ctx , c .TrustedRootPath , c .CertChain , c .CARoots , c .CAIntermediates , c .TSACertChainPath , co )
134+ if err != nil {
135+ return fmt .Errorf ("setting trusted material: %w" , err )
152136 }
153137
154138 if err = CheckSigstoreBundleUnsupportedOptions (* c , co ); err != nil {
0 commit comments