Skip to content

pkcs7: support for RFC5652 5.2.1 #812

@woodruffw

Description

@woodruffw

I'm trying to parse one of Microsoft's custom PKCS#7 containers, and I'm running up against the following error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Der(Error { kind: TagUnexpected { expected: Some(Tag(0x04: OCTET STRING)), actual: Tag(0x30: SEQUENCE) }, position: None })', examples/demo.rs:12:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is happening because CMS as defined in RFC 5652 defines eContent as follows:

      eContent [0] EXPLICIT OCTET STRING OPTIONAL

whereas PKCS7 defines content (the predecessor to eContent) as follows:

      content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL

Microsoft naturally makes use of this, and chooses to make their content a SEQUENCE instead of an OCTET STRING:

SEQUENCE (2 elem)
        OBJECT IDENTIFIER 1.3.6.1.4.1.311.10.1 certTrustList (Microsoft contentType)
        [0] (1 elem)
          SEQUENCE (5 elem)

I'll work on a fix for this; just filing an issue for visibility 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions