Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions decrypt/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func DataWithFormat(data []byte, format Format) (cleartext []byte, err error) {
key,
tree.Metadata.LastModified.Format(time.RFC3339),
)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case err != nil, very likely the check originalMac != mac also fails, so an error would have already been returned - but the message would not be so helpful (probably something like "...: expected mac xxx, got "). So handling the error here is definitely a good thing!

return nil, fmt.Errorf("Failed to decrypt original mac: %w", err)
}
if originalMac != mac {
return nil, fmt.Errorf("Failed to verify data integrity. expected mac %q, got %q", originalMac, mac)
}
Expand Down