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

Function parseImgcryptFlags

pkg/cmd/image/crypt.go:106–122  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

104
105// parseImgcryptFlags corresponds to https://github.com/containerd/imgcrypt/blob/v1.1.2/cmd/ctr/commands/images/crypt_utils.go#L244-L252
106func 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
124func composeConvertFunc(a, b converter.ConvertFunc) converter.ConvertFunc {
125 return func(ctx context.Context, cs content.Store, desc ocispec.Descriptor) (*ocispec.Descriptor, error) {

Callers 1

CryptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…