dishmaker
dishmaker
Potential fix for: - #1745 - #1746 Not the best solution, but a proof-of-concept of internal API that `ContextSpecific` wrapper would use.
The problem is that `Encode` and `Decode` traits are needed for everything encoded with `IMPLICIT` wrapper. `IMPLICIT` wrapper should require only `EncodeValue + DecodeValue + IsConstructed`. Related: - #1745 I...
`EXPLICIT` wrapper should require only `Encode + Decode`. https://github.com/RustCrypto/formats/blob/7ccdb0d4bf6c2f27a32f512798828e94126f698c/der/src/asn1/context_specific.rs#L149-L151 Currently it impls `Encode` through `EncodeValue + Tagged` https://github.com/RustCrypto/formats/blob/7ccdb0d4bf6c2f27a32f512798828e94126f698c/der/src/encode.rs#L69-L71
Closes #1741 This PR drops the need to implement `Tagged` on all structs that are IMPLICIT. For example `CHOICE` does not implement `FixedTag`, but is always constructed.
Example of erroneous test for - #1736
IMPLICIT decoder requires `Tagged` trait. https://github.com/RustCrypto/formats/blob/937e611fcbabe929f2ff76320dd33873ea3372dd/der/src/asn1/context_specific.rs#L58-L63 IMPLICIT and EXPLICIT decoders check for constructed bit. But IMPLICIT depends on `value.tag()` in runtime: https://github.com/RustCrypto/formats/blob/937e611fcbabe929f2ff76320dd33873ea3372dd/der/src/asn1/context_specific.rs#L69-L70 https://github.com/RustCrypto/formats/blob/937e611fcbabe929f2ff76320dd33873ea3372dd/der/src/asn1/context_specific.rs#L161-L164 I think it should check constructed bit...
Potential fix for: - #1723
Currently, there is no `read_nested` in implicit context-specific decoder. https://github.com/RustCrypto/formats/blob/93c8be896cc3d649777fc3d9539878db46f40609/der/src/asn1/context_specific.rs#L66-L67
Looks like currently tag numbers lower than requested are skipped. Decoder breaks only on higher than expected tag numbers: `if !tag.is_context_specific() || tag.number() > tag_number { break }` Commit history:...