Skip to content

Conversation

@tarcieri
Copy link
Member

This was added in #1877 but the real value of that PR was the automatic read_nested on DecodeValue impls. Reader::read_value isn't actually necessary for that at all.

It may be useful in the future if we introduce a BER reader that can handle decoding constructed e.g. strings from indefinite length encoding, but since we don't actually have anything like that yet, removing this avoids some unnecessary duplication and API surface for the Reader.

This was added in #1877 but the real value of that PR was the automatic
`read_nested` on `DecodeValue` impls. `Reader::read_value` isn't
actually necessary for that at all.

It may be useful in the future if we introduce a BER reader that can
handle decoding constructed e.g. strings from indefinite length
encoding, but since we don't actually have anything like that yet,
removing this avoids some unnecessary duplication and API surface for
the `Reader`.
@tarcieri tarcieri merged commit 5277fcf into master Jun 21, 2025
107 checks passed
@tarcieri tarcieri deleted the der/remove-read-value branch June 21, 2025 16:57
tarcieri added a commit that referenced this pull request Jul 2, 2025
tarcieri added a commit that referenced this pull request Jul 2, 2025
One of the blockers for addressing indefinite length handling (#779) has
been where to consume the EOC tag.

This commit (re)introduces `Reader::read_value` (added in #1877, removed
in #1887) and handles decoding the EOC there. This gives us a single
place where EOC can be handled for all constructed messages.

With these changes, the decoder is able to parse `cms_ber.bin` from
`cms/tests`, from which the `cms_der.bin` file has been translated. This
file provides a real-world example of nested indefinite lengths from
CMS.

Note, however, that the example contains a constructed `Any` which isn't
yet being correctly handled. A `TODO` for ensuring the BER and DER
decode identically has been added.
tarcieri added a commit that referenced this pull request Jul 2, 2025
One of the blockers for addressing indefinite length handling (#779) has
been where to consume the EOC tag.

This commit (re)introduces `Reader::read_value` (added in #1877, removed
in #1887) and handles decoding the EOC there. This gives us a single
place where EOC can be handled for all constructed messages.

With these changes, the decoder is able to parse `cms_ber.bin` from
`cms/tests`, from which the `cms_der.bin` file has been translated. This
file provides a real-world example of nested indefinite lengths from
CMS.

Note, however, that the example contains a constructed `Any` which isn't
yet being correctly handled. A `TODO` for ensuring the BER and DER
decode identically has been added.
tarcieri added a commit that referenced this pull request Jul 2, 2025
One of the blockers for addressing indefinite length handling (#779) has
been where to consume the EOC tag.

This commit (re)introduces `Reader::read_value` (added in #1877, removed
in #1887) and handles decoding the EOC there. This gives us a single
place where EOC can be handled for all constructed messages.

With these changes, the decoder is able to parse `cms_ber.bin` from
`cms/tests`, from which the `cms_der.bin` file has been translated. This
file provides a real-world example of nested indefinite lengths from
CMS.

Note, however, that the example contains a constructed `Any` which isn't
yet being correctly handled. A `TODO` for ensuring the BER and DER
decode identically has been added.
tarcieri added a commit that referenced this pull request Jul 2, 2025
One of the blockers for addressing indefinite length handling (#779) has
been where to consume the EOC tag.

This commit (re)introduces `Reader::read_value` (added in #1877, removed
in #1887) and handles decoding the EOC there. This gives us a single
place where EOC can be handled for all constructed messages.

With these changes, the decoder is able to parse `cms_ber.bin` from
`cms/tests`, from which the `cms_der.bin` file has been translated. This
file provides a real-world example of nested indefinite lengths from
CMS.

Note, however, that the example contains a constructed `Any` which isn't
yet being correctly handled. A `TODO` for ensuring the BER and DER
decode identically has been added.
tarcieri added a commit that referenced this pull request Jul 2, 2025
One of the blockers for addressing indefinite length handling (#779) has
been where to consume the EOC tag.

This commit (re)introduces `Reader::read_value` (added in #1877, removed
in #1887) and handles decoding the EOC there. This gives us a single
place where EOC can be handled for all constructed messages.

With these changes, the decoder is able to parse `cms_ber.bin` from
`cms/tests`, from which the `cms_der.bin` file has been translated. This
file provides a real-world example of nested indefinite lengths from
CMS.

Note, however, that the example contains a constructed `Any` which isn't
yet being correctly handled. A `TODO` for ensuring the BER and DER
decode identically has been added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants