-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hashed message verification #118
Conversation
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
Codecov Report
@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 50.21% 51.39% +1.17%
==========================================
Files 14 14
Lines 687 683 -4
==========================================
+ Hits 345 351 +6
+ Misses 307 295 -12
- Partials 35 37 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
2aaef1c
to
2943ec5
Compare
Signed-off-by: Hector Fernandez <hector@chainguard.dev>
874249e
to
b143398
Compare
Co-authored-by: Bob Callaway <bobcallaway@users.noreply.github.com> Signed-off-by: Hector Fernandez <hector@chainguard.dev>
b143398
to
432c7f6
Compare
@bobcallaway Thanks for the review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks for fixing! Looks like the root cause was reading into a buffer of size(sha256 hash) bytes
Summary
When trying to time-stamp messages longer than 32 bytes, I realized the verification function was failing to verify the response and the input message hashes. I was seen the following error:
Hashed messages don't match
.Then I had a look at the
digitorus/timestamp
implementation and I observed that messages longer than 32 bytes were timestamped without issues. So I had a look at our verification code and found a different way of validating the hashed messages than the one used in the timestamp code.I changed the verify code function to follow the same approach, so we can validate the hashed message as done in
digitorus/timestamp
.To reproduce the issue, you can simply change the example in our readme from
myblob
toblobblobblobblobblobblobblobblobblob
, and you will get the failed hashed comparison using the verify cmd.Release Note
fix: verify hashed messages
Documentation