-
Notifications
You must be signed in to change notification settings - Fork 134
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
der: Generic custom-class long > 30 tags PRIVATE, CONTEXT-SPECIFIC, APPLICATION #1545
base: master
Are you sure you want to change the base?
Conversation
756ef5f
to
41fa980
Compare
…re stored in long form draft: CustomClass generic type feat: add decode_implicit and decode_explicit back fix: cargo test -p der now pass refactor: raname to Explicit struct refactor: TAG, T order docs: CustomClass feat: add ContextSpecificRef back (ContextSpecificExplicitRef) update der-derive to current der implementation feat: add tests for context-specific fix: dependency crates fixed for x509-cert cargo fmt fix: crates depending on context-specific and long TagNumber fix x509-cert
02c666a
to
fd9b041
Compare
Sorry for not providing documentation on |
I've tested this PR with a prototype for parsing the Android key attestation X.509 extension that exclusively has tags >31. No issues discovered. |
Currently, formats/der/src/asn1/custom_class.rs Line 184 in 116ce15
I think it might be useful for some types to implement But if impl<T: FixedTag> IsConstructed for T {
/// ASN.1 constructed bit, used for CONTEXT-SPECIFIC IMPLICIT encoding
const CONSTRUCTED: bool = T::TAG.is_constructed();
} |
PR support private tags and tag numbers >30 that are stored in long form #1416
Issue der: Encoding higher tag number #1381
Issue der: implementing other tag classes than Context-Specific #877
In this PR:
Allow the use of tag numbers >30. In the der representation they are stored in the long form as multiple bytes.
Allow APPLCATION and PRIVATE tags to be annotated like context specific ones in the derive macros
Merge application, private, context-specific tags into one generic codebase
CustomClass
.Split
EXPLICIT
andIMPLICIT
encoding into CustomClassExplicit/ImplicitAdd generic
TAG: u16
to eg.ContextSpecificExplicit
wrapper.Fix the need of implementing both
Decode
andDecodeValue
onCONTEXT-SPECIFIC
tags.EXPLICIT
tags only need to implementDecode<'a>
.IMPLICIT
tags only need to implementDecodeValue<'a>
andTagged
.Tagged
too - it is needed for checking constructed bit.Add
read_nested
forIMPLICIT
decoder (I had to fix x509-cert then tests, negative ones)In implicit
Decode
there was no read_nested before:formats/der/src/asn1/context_specific.rs
Lines 66 to 67 in c501837
Main breaking feature is here:
formats/der/src/asn1/context_specific.rs
Lines 9 to 23 in 756ef5f