Skip to content

Commit

Permalink
Rename goodkey.KeyPolicy.dbCheck to blockedCheck
Browse files Browse the repository at this point in the history
Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Feb 11, 2023
1 parent 0e8e289 commit a721c76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions goodkey/good_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type KeyPolicy struct {
weakRSAList *WeakRSAKeys
blockedList *blockedKeys
fermatRounds int
dbCheck BlockedKeyCheckFunc
blockedCheck BlockedKeyCheckFunc
}

// NewKeyPolicy returns a KeyPolicy that allows RSA, ECDSA256 and ECDSA384.
Expand All @@ -96,7 +96,7 @@ func NewKeyPolicy(config *Config, bkc BlockedKeyCheckFunc) (KeyPolicy, error) {
AllowRSA: true,
AllowECDSANISTP256: true,
AllowECDSANISTP384: true,
dbCheck: bkc,
blockedCheck: bkc,
}
if config.WeakKeyFile != "" {
keyList, err := LoadWeakRSASuffixes(config.WeakKeyFile)
Expand Down Expand Up @@ -141,12 +141,12 @@ func (policy *KeyPolicy) GoodKey(ctx context.Context, key crypto.PublicKey) erro
return badKey("public key is forbidden")
}
}
if policy.dbCheck != nil {
if policy.blockedCheck != nil {
digest, err := core.KeyDigest(key)
if err != nil {
return badKey("%w", err)
}
exists, err := policy.dbCheck(ctx, digest[:])
exists, err := policy.blockedCheck(ctx, digest[:])
if err != nil {
return err
} else if exists {
Expand Down

0 comments on commit a721c76

Please sign in to comment.