Skip to content

Commit

Permalink
Skip verification for GetHashKey is the data is not signed
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybear327 committed Jun 27, 2024
1 parent aed3dbb commit 3bbae95
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions link_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,18 @@ func (l Link) GetHashKey(parentNodeKey, addrKRs *crypto.KeyRing) ([]byte, error)
return nil, err
}

dec, err := parentNodeKey.Decrypt(enc, addrKRs, crypto.GetUnixTime())
if err != nil {
return nil, err
_, ok := enc.GetSignatureKeyIDs()
var dec *crypto.PlainMessage
if ok {
dec, err = parentNodeKey.Decrypt(enc, addrKRs, crypto.GetUnixTime())
if err != nil {
return nil, err
}
} else {
dec, err = parentNodeKey.Decrypt(enc, nil, 0)
if err != nil {
return nil, err
}
}

return dec.GetBinary(), nil
Expand Down

0 comments on commit 3bbae95

Please sign in to comment.