-
Notifications
You must be signed in to change notification settings - Fork 4
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: fix MessageImprint.HashAlgorithm.Parameters #24
Conversation
Signed-off-by: Patrick Zheng <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
=======================================
Coverage ? 95.21%
=======================================
Files ? 19
Lines ? 732
Branches ? 0
=======================================
Hits ? 697
Misses ? 18
Partials ? 17 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
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.
LGTM
Could you have a look at this test? Is it by design? |
Yes, it is by design by the golang library, but that's not by design of RFC 3161. When a TSA request contains |
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
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.
LGTM with suggestions.
Signed-off-by: Patrick Zheng <[email protected]>
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.
LGTM
This PR fixes
MessageImprint.HashAlgorithm.Parameters
and added corresponding validation in TSA response based on RFC 3161.The issue that this PR is trying to fix is:
Golang's asn1.RawValue has zero value with
Tag 0
, which is actually not a valid asn1 tag (https://luca.ntop.org/Teaching/Appunti/asn1.html).The correct zero value of the struct should be asn1.NullRawValue with
Tag 5
. However,asn1.NullRawValue
is not a valid asn1 object either. The valid struct, as added by this PR, should be:If running the below piece of code:
The printouts will be:
(This is a known issue of golang encoding/asn1 package: golang/go#30414. The issue was closed without any code update though)