File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ one of the JWKs in the JWK Set.`,
5050 },
5151 cli.StringFlag {
5252 Name : "password-file" ,
53- Usage : `The path to the <file> containing the password to encrypt the keys.` ,
53+ Usage : `The path to the <file> containing the password to decrypt the keys.` ,
5454 },
5555 },
5656 }
Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ parameter is ignored by JWE implementations, but may be processed by
151151applications that use JWE.` ,
152152 },
153153 flags .SubtleHidden ,
154+ cli.StringFlag {
155+ Name : "password-file" ,
156+ Usage : `The path to the <file> containing the password to encrypt the keys.` ,
157+ },
154158 },
155159 }
156160}
@@ -188,6 +192,7 @@ func encryptAction(ctx *cli.Context) error {
188192 typ := ctx .String ("typ" )
189193 cty := ctx .String ("cty" )
190194 isSubtle := ctx .Bool ("subtle" )
195+ passwordFile := ctx .String ("password-file" )
191196
192197 switch {
193198 case isPBES2 && key != "" :
@@ -224,7 +229,17 @@ func encryptAction(ctx *cli.Context) error {
224229 case jwks != "" :
225230 jwk , err = jose .ReadKeySet (jwks , options ... )
226231 case isPBES2 :
227- pbes2Key , err = ui .PromptPassword ("Please enter the password to encrypt the content encryption key" )
232+ var password string
233+ if passwordFile != "" {
234+ password , err = utils .ReadStringPasswordFromFile (passwordFile )
235+ if err != nil {
236+ return err
237+ }
238+ }
239+ pbes2Key , err =
240+ ui .PromptPassword (
241+ "Please enter the password to encrypt the content encryption key" ,
242+ ui .WithValue (password ))
228243 default :
229244 return errs .RequiredOrFlag (ctx , "key" , "jwks" )
230245 }
You can’t perform that action at this time.
0 commit comments