Skip to content

Commit

Permalink
use PublicKey's Equal method to compare the public keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrtr committed Nov 15, 2021
1 parent 328c957 commit ef0b86a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/auth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (opts *jwtOptions) rsaKey() (interface{}, error) {
}

// both keys provided, make sure they match
if pub != nil && (pub.E != priv.E || pub.N.Cmp(priv.N) != 0) {
if pub != nil && !pub.Equal(priv.Public()) {
return nil, ErrKeyMismatch
}

Expand Down Expand Up @@ -183,8 +183,7 @@ func (opts *jwtOptions) ecKey() (interface{}, error) {
}

// both keys provided, make sure they match
if pub != nil && (pub.Curve != priv.Curve ||
pub.X.Cmp(priv.X) != 0 || pub.Y.Cmp(priv.Y) != 0) {
if pub != nil && !pub.Equal(priv.Public()) {
return nil, ErrKeyMismatch
}

Expand Down

0 comments on commit ef0b86a

Please sign in to comment.