parseImgcryptFlags corresponds to https://github.com/containerd/imgcrypt/blob/v1.1.2/cmd/ctr/commands/images/crypt_utils.go#L244-L252
(options types.ImageCryptOptions, encrypt bool)
| 104 | |
| 105 | // parseImgcryptFlags corresponds to https://github.com/containerd/imgcrypt/blob/v1.1.2/cmd/ctr/commands/images/crypt_utils.go#L244-L252 |
| 106 | func parseImgcryptFlags(options types.ImageCryptOptions, encrypt bool) (parsehelpers.EncArgs, error) { |
| 107 | var a parsehelpers.EncArgs |
| 108 | |
| 109 | a.GPGHomedir = options.GpgHomeDir |
| 110 | a.GPGVersion = options.GpgVersion |
| 111 | a.Key = options.Keys |
| 112 | if encrypt { |
| 113 | a.Recipient = options.Recipients |
| 114 | if len(a.Recipient) == 0 { |
| 115 | return a, errors.New("at least one recipient must be specified (e.g., --recipient=jwe:mypubkey.pem)") |
| 116 | } |
| 117 | } |
| 118 | // While --recipient can be specified only for `nerdctl image encrypt`, |
| 119 | // --dec-recipient can be specified for both `nerdctl image encrypt` and `nerdctl image decrypt`. |
| 120 | a.DecRecipient = options.DecRecipients |
| 121 | return a, nil |
| 122 | } |
| 123 | |
| 124 | func composeConvertFunc(a, b converter.ConvertFunc) converter.ConvertFunc { |
| 125 | return func(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…