Skip to content

Commit

Permalink
Fix sign hybrid bug
Browse files Browse the repository at this point in the history
  • Loading branch information
david415 committed May 2, 2024
1 parent 6dbc08c commit 051c687
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sign/hybrid/hybrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,17 @@ func (p *PublicKey) Equal(key crypto.PublicKey) bool {
if err != nil {
panic(err)
}
blob2, err := key.(*PublicKey).MarshalBinary()
if err != nil {
panic(err)
var blob2 []byte
switch v := key.(type) {
case []byte:
blob2 = v
case *PublicKey:
blob2, err = v.MarshalBinary()
if err != nil {
panic(err)
}
default:
panic("type assertion failed")
}
return hmac.Equal(blob1, blob2)
}
Expand Down

0 comments on commit 051c687

Please sign in to comment.