RustCrypto / RustCrypto/formats
der: derive(Choice) needs `constructed = "true"` flag
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 338
- Forks
- 188
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 15
Description
derive(Choice) needs constructed = "true" flag,
but derive(Sequence) does not.
#[derive(Choice)]
pub enum ImplicitChoice<'a> {
// This works:
#[asn1(context_specific = "3", tag_mode = "IMPLICIT", constructed = "true")]
SequenceOfNulls(SequenceOf<Null, 1>),
// This won't decode:
#[asn1(context_specific = "3", tag_mode = "IMPLICIT")]
SequenceOfNulls(SequenceOf<Null, 1>),
}
I mean, the Choice macro is clueless about the underlaying type.
Something like this is possible:
let tag: Tag = Tag::Utf8String;
match tag {
String::TAG => {}
Null::TAG => {}
SequenceOf::<Null, 1>::TAG => {}
// .. more choices
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Rust derive(Choice) macro, then compare how it determines tags and constructed status for SequenceOf with derive(Sequence). Reproduce the shown implicit SequenceOf<Null, 1> case and confirm decoding succeeds without the explicit flag; done means the Choice-derived case handles the underlying type consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100