MCPcopy Create free account
hub / github.com/containerd/nerdctl / Verify

Function Verify

pkg/signutil/signutil.go:56–81  ·  view source on GitHub ↗

Verify verifies an image using a verifier and options provided in options.

(ctx context.Context, rawRef string, hostsDirs []string, experimental bool, options types.ImageVerifyOptions)

Source from the content-addressed store, hash-verified

54
55// Verify verifies an image using a verifier and options provided in options.
56func Verify(ctx context.Context, rawRef string, hostsDirs []string, experimental bool, options types.ImageVerifyOptions) (ref string, err error) {
57 switch options.Provider {
58 case "cosign":
59 if !experimental {
60 return "", fmt.Errorf("cosign only work with enable experimental feature")
61 }
62
63 if ref, err = VerifyCosign(ctx, rawRef, options.CosignKey, hostsDirs, options.CosignCertificateIdentity, options.CosignCertificateIdentityRegexp, options.CosignCertificateOidcIssuer, options.CosignCertificateOidcIssuerRegexp); err != nil {
64 return "", err
65 }
66 case "notation":
67 if !experimental {
68 return "", fmt.Errorf("notation only work with enable experimental feature")
69 }
70
71 if ref, err = VerifyNotation(ctx, rawRef, hostsDirs); err != nil {
72 return "", err
73 }
74 case "", "none":
75 ref = rawRef
76 log.G(ctx).Debugf("verifying process skipped")
77 default:
78 return "", fmt.Errorf("no verifiers found: %s", options.Provider)
79 }
80 return ref, nil
81}

Callers 2

EnsureImageFunction · 0.92
NewFunction · 0.92

Calls 2

VerifyCosignFunction · 0.85
VerifyNotationFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…