cryptImage is the dispatcher to encrypt/decrypt an image; it accepts either an OCI descriptor representing a manifest list or a single manifest
(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter, cryptoOp cryptoOp)
| 449 | // cryptImage is the dispatcher to encrypt/decrypt an image; it accepts either an OCI descriptor |
| 450 | // representing a manifest list or a single manifest |
| 451 | func cryptImage(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter, cryptoOp cryptoOp) (ocispec.Descriptor, bool, error) { |
| 452 | if cc == nil { |
| 453 | return ocispec.Descriptor{}, false, errors.New("invalid argument: CryptoConfig must not be nil") |
| 454 | } |
| 455 | switch desc.MediaType { |
| 456 | case ocispec.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList: |
| 457 | return cryptManifestList(ctx, cs, desc, cc, lf, cryptoOp) |
| 458 | case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest: |
| 459 | return cryptManifest(ctx, cs, desc, cc, lf, cryptoOp) |
| 460 | default: |
| 461 | return ocispec.Descriptor{}, false, fmt.Errorf("unhandled media type: %s", desc.MediaType) |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | // EncryptImage encrypts an image; it accepts either an OCI descriptor representing a manifest list or a single manifest |
| 466 | func EncryptImage(ctx context.Context, cs content.Store, desc ocispec.Descriptor, cc *encconfig.CryptoConfig, lf LayerFilter) (ocispec.Descriptor, bool, error) { |
no test coverage detected
searching dependent graphs…