Adds to DER format of ECDSA signature with extended ECDSA-Sig-Value and ECDSA-Full-R#369
Open
gstarovo wants to merge 1 commit intotlsfuzzer:masterfrom
Open
Adds to DER format of ECDSA signature with extended ECDSA-Sig-Value and ECDSA-Full-R#369gstarovo wants to merge 1 commit intotlsfuzzer:masterfrom
gstarovo wants to merge 1 commit intotlsfuzzer:masterfrom
Conversation
Contributor
Author
|
I will provide more coverage for the newly added code, as the results of the checks indicate coverage decline. |
0961801 to
e17d333
Compare
e17d333 to
7f2a47b
Compare
19ac7b2 to
f173f56
Compare
627de8b to
9c23305
Compare
9c23305 to
b046e1f
Compare
tomato42
requested changes
Nov 3, 2025
| """ | ||
| if not string: | ||
| raise UnexpectedDER( | ||
| "Empty string is an invalid " "encoding of a boolean" |
| body = string[1 + lengthlength : 1 + lengthlength + length] | ||
| rest = string[1 + lengthlength + length :] | ||
| if not body: | ||
| raise UnexpectedDER("Empty object identifier") |
| if body == b"\x00": | ||
| return False, rest | ||
| # the workaround due to instrumental, that | ||
| # saves the binary data as UF-8 string |
Member
There was a problem hiding this comment.
this method shouldn't be passed Unicode strings ever...
| point = ellipticcurve.AbstractPoint.from_bytes( | ||
| self.generator.curve(), r | ||
| ) | ||
| r = point[0] % n |
| :param accelerate: an indicator for ECDSA sign operation to return | ||
| an ECPoint instead of a number of "r" parameter. | ||
| Applicable only for ECDSA key. | ||
| :type accelerate: boolean |
Member
There was a problem hiding this comment.
but we already are using the sigencode for specifying the output format...
| :param accelerate: an indicator for ECDSA sign operation to return | ||
| an ECPoint instead of a number of "r" parameter. | ||
| Applicable only for ECDSA key. | ||
| :type accelerate: boolean |
Member
There was a problem hiding this comment.
same here, sigencode should specify the format we want...
| leak the key. Caller should try a better entropy source, retry with | ||
| different ``k``, or use the | ||
| :func:`~SigningKey.sign_deterministic` in such case. | ||
| :param accelerate: an indicator for ECDSA sign operation to return |
| self.assertIn("Empty object identifier", str(e.exception)) | ||
|
|
||
| def test_several_boolean_octets(self): | ||
| data = b"\x01\x02\x01\x01" |
Member
There was a problem hiding this comment.
could you also test with b"\x01\x00 ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The changes expand encoding/decoding of the ECDSA signature in DER format: expanded ECDSA-Sig-Value format and ECDSA-Full-R.
The definition of the formats can be found in document section C.5, page 114.
The changes bring supporting functions like encoding and decoding of boolean according to ASN.1 standard.
Beside that, the changes add parameter and slightly modifies ECDSA signing function for enabling return of the whole point (instead of 'r').
The testing coverage of encoding/decoding with new function is also present.
Also, there are some formatting changes made with black formatter.