MCPcopy Create free account
hub / github.com/containerd/imgcrypt / cryptManifest

Function cryptManifest

images/encryption/encryption.go:366–381  ·  view source on GitHub ↗

cryptManifest encrypts or decrypts the children of a top level manifest

(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter, cryptoOp cryptoOp)

Source from the content-addressed store, hash-verified

364
365// cryptManifest encrypts or decrypts the children of a top level manifest
366func cryptManifest(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter, cryptoOp cryptoOp) (ocispec.Descriptor, bool, error) {
367 p, err := content.ReadBlob(ctx, cs, desc)
368 if err != nil {
369 return ocispec.Descriptor{}, false, err
370 }
371 var manifest ocispec.Manifest
372 if err := json.Unmarshal(p, &manifest); err != nil {
373 return ocispec.Descriptor{}, false, err
374 }
375 platform := platforms.DefaultSpec()
376 newDesc, modified, err := cryptChildren(ctx, cs, desc, cc, lf, cryptoOp, &platform)
377 if err != nil || cryptoOp == cryptoOpUnwrapOnly {
378 return ocispec.Descriptor{}, false, err
379 }
380 return newDesc, modified, nil
381}
382
383// cryptManifestList encrypts or decrypts the children of a top level manifest list
384func cryptManifestList(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter, cryptoOp cryptoOp) (ocispec.Descriptor, bool, error) {

Callers 1

cryptImageFunction · 0.85

Calls 1

cryptChildrenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…