Skip to content

Commit

Permalink
Fix p2c handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lestrrat committed Dec 3, 2023
1 parent 9e4f840 commit 0535c19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jwe/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ func doDecryptCtx(dctx *decryptCtx) ([]byte, error) {
if !ok {
return nil, errors.Errorf("unexpected type for 'p2c': %T", count)
}
// in v1, this number is hardcoded to 10000. Use v2 if you need to
// finetune this value
if countFlt > 10000 {
return nil, errors.Errorf("invalid value for 'p2c'")
}
salt, err := base64.DecodeString(saltB64Str)
if err != nil {
return nil, errors.Wrap(err, "failed to b64-decode 'salt'")
Expand Down

0 comments on commit 0535c19

Please sign in to comment.