Skip to content

der: add ApplicationExplicit, ContextSpecificExplicit, PrivateExplicit#1945

Closed
dishmaker wants to merge 1 commit into
RustCrypto:masterfrom
dishmaker:dishmaker/der_custom_class_explicit_macro
Closed

der: add ApplicationExplicit, ContextSpecificExplicit, PrivateExplicit#1945
dishmaker wants to merge 1 commit into
RustCrypto:masterfrom
dishmaker:dishmaker/der_custom_class_explicit_macro

Conversation

@dishmaker

Copy link
Copy Markdown
Contributor

Partially fixes

Derive macro support in future PR.

@dishmaker

dishmaker commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

This partially fixes #1808, because we can rewrite derive(Choice) as:

match tag {
    String::TAG => {}
    // ContextSpecificExplicit knows it's constructed, without trickery
    ContextSpecificExplicit::<2, BitString>::TAG => {}
    // .. more choices
}

@tarcieri

Copy link
Copy Markdown
Member

I'm getting a little worried about the internal_macros module. It's a lot of macros. Perhaps there are some non-macro-based abstractions to explore there.

@dishmaker

Copy link
Copy Markdown
Contributor Author

So my plan is to make this PR pure generic *Explicit.

CustomTagExplicit<TAG, T, CLASS>

Meanwhile, macro code will stay the same and will be eventually deprecated (because of trait flaws).

Generic wrapper around `APPLICATION`, `CONTEXT-SPECIFIC` and `PRIVATE` tags.
Such struct simplifies decoding, as previously we had to assert that
decoded tag number is the expected one.
@dishmaker
dishmaker force-pushed the dishmaker/der_custom_class_explicit_macro branch from 0aa605c to 347049d Compare August 22, 2025 13:46
@dishmaker

Copy link
Copy Markdown
Contributor Author

Naming is hard... choices:

  • ClassTaggedExplicit
  • CustomClassExplicit
  • NonUniversalExplicit
  • ?

@tarcieri

Copy link
Copy Markdown
Member

Sorry I didn't get to this. Closing as stale, but feel free to reopen.

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