MCPcopy Create free account
hub / github.com/containers/image / sourceSignatures

Method sourceSignatures

copy/sign.go:56–76  ·  view source on GitHub ↗

sourceSignatures returns signatures from unparsedSource, and verifies that they can be used (to avoid copying a large image when we can tell in advance that it would ultimately fail)

(ctx context.Context, unparsed private.UnparsedImage,
	gettingSignaturesMessage, checkingDestMessage string)

Source from the content-addressed store, hash-verified

54// and verifies that they can be used (to avoid copying a large image when we
55// can tell in advance that it would ultimately fail)
56func (c *copier) sourceSignatures(ctx context.Context, unparsed private.UnparsedImage,
57 gettingSignaturesMessage, checkingDestMessage string) ([]internalsig.Signature, error) {
58 var sigs []internalsig.Signature
59 if c.options.RemoveSignatures {
60 sigs = []internalsig.Signature{}
61 } else {
62 c.Printf("%s\n", gettingSignaturesMessage)
63 s, err := unparsed.UntrustedSignatures(ctx)
64 if err != nil {
65 return nil, fmt.Errorf("reading signatures: %w", err)
66 }
67 sigs = s
68 }
69 if len(sigs) != 0 {
70 c.Printf("%s\n", checkingDestMessage)
71 if err := c.dest.SupportsSignatures(ctx); err != nil {
72 return nil, fmt.Errorf("Can not copy signatures to %s: %w", transports.ImageName(c.dest.Reference()), err)
73 }
74 }
75 return sigs, nil
76}
77
78// createSignatures creates signatures for manifest and an optional identity.
79func (c *copier) createSignatures(ctx context.Context, manifest []byte, identity reference.Named) ([]internalsig.Signature, error) {

Callers 2

copyMultipleImagesMethod · 0.95
copySingleImageMethod · 0.95

Calls 5

PrintfMethod · 0.95
ImageNameFunction · 0.92
UntrustedSignaturesMethod · 0.65
SupportsSignaturesMethod · 0.65
ReferenceMethod · 0.65

Tested by

no test coverage detected