Skip to content
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

WIP: Parsing with lax mode #810

Closed
wants to merge 1 commit into from
Closed

WIP: Parsing with lax mode #810

wants to merge 1 commit into from

Conversation

smndtrl
Copy link
Contributor

@smndtrl smndtrl commented Dec 19, 2022

This allows parsing DER with some "features" from BER that are in use (in the apple universe)

  • Reading indefinite length tags by using length = 0
  • Reading constructed/encapsulated OctetStrings (only if 1! OctetString is part of a indefinite length OctetString) as that is east without alloc

This is my first try to address this issue

@tarcieri
Copy link
Member

Since features are additive across crates, this really needs to be a separate "profile" which can be used concurrently with fully validating DER.

That will likely involve adding some kind of trait for profiles and a generic parameter to e.g. Decode and/or Reader

@smndtrl
Copy link
Contributor Author

smndtrl commented Dec 19, 2022

Thanks for the info. Learned something new about features today.

However the approach you mentioned may be outside of what I'm comfortable doing with Rust atm.

@tarcieri
Copy link
Member

Going to close this then

@tarcieri tarcieri closed this Dec 20, 2022
tarcieri added a commit that referenced this pull request Jan 9, 2024
Adds an enum with `Ber` and `Der` (default) variants which can be used
to selectively allow a limited number of BER productions when decoding
certain BER-based security-oriented formats, e.g. CMS, PKCS#8.

Currently this doesn't actually do anything, however the goal is to
address #779, where we can't decode CMS generated by Apple tooling.

PR #810 is an example of how the rules could be relaxed to support
`IndefiniteLength`s.
tarcieri added a commit that referenced this pull request Jan 9, 2024
Adds an enum with `Ber` and `Der` (default) variants which can be used
to selectively allow a limited number of BER productions when decoding
certain BER-based security-oriented formats, e.g. CMS, PKCS#8.

Currently this doesn't actually do anything, however the goal is to
address #779, where we can't decode CMS generated by Apple tooling.

PR #810 is an example of how the rules could be relaxed to support
`IndefiniteLength`s.
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