Skip to content

der: breaking changes in ObjectIdentifier and AnyRef with tag_mode = IMPLICIT #1976

@kamulos

Description

@kamulos

So I was just trying to change my application from my self-made support for private tags to the upstream support in the release candidates. (Thanks @tarcieri and @turbocool3r for following through on that).

In my code two things broke, that might not be intentional. So this example is a minimized version of my issues:

use der::{AnyRef, Decode, FixedTag, Sequence, oid::ObjectIdentifier};

#[derive(Debug, Sequence)]
pub struct SomeType<'a> {
    pub oid: ObjectIdentifier,
    #[asn1(context_specific = "0", tag_mode = "IMPLICIT")]
    pub data: AnyRef<'a>,
}

fn main() {
    let _ = ObjectIdentifier::TAG;

    let bytes = b"\x30\x12\x06\x07\x2a\x86\x48\xce\x3d\x02\x01\x80\x07\x63\x6f\x6e\x74\x65\x6e\x74";
    let decoded = SomeType::from_der(bytes).unwrap();
    println!("{:02x?}", decoded.data.value());
}
  1. ObjectIdentifier::TAG does not work anymore without specifying MAX_SIZE. This broke in d4395cd
  2. AnyRef does not work anymore with tag_mode = IMPLICIT. That broke in be1caa3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions