formats icon indicating copy to clipboard operation
formats copied to clipboard

der: implementing other tag classes than Context-Specific

Open ghost opened this issue 2 years ago • 7 comments

Hello,

first of all thanks for the crate.

I need to parse (and also write) serialized asn1 sequences, where the tags are given as application tag classes, i.e.:

InitiateSession ::= [APPLICATION 0] IMPLICIT SEQUENCE {
    sid-a                [APPLICATION 10] IMPLICIT OCTET STRING (SIZE(8..32)),
    login-protocol-list  [APPLICATION 11] IMPLICIT OCTET STRING,
    system-use-text      [APPLICATION 31] IMPLICIT UTF8String (SIZE(1..512)) OPTIONAL,
    server-msg-buf-size  [APPLICATION 32] IMPLICIT OCTET STRING (SIZE(2..2)) OPTIONAL
}

I do not think this is already possible with this library? I only found the distinguishing between context-specific and universal tags when you want to encode a struct (with derives) to der. Are there plan to implement that? https://github.com/RustCrypto/formats/blob/b20d644ad718db22618205bd0c1854c12e9bfe0e/der/derive/src/tag.rs#L13

ghost avatar Feb 22 '23 14:02 ghost

We don’t currently have plans to implement this, and generally implement features as needed by the cryptographic formats implemented in this repo.

What format are you trying to implement?

tarcieri avatar Feb 22 '23 15:02 tarcieri

I am trying to implement that in DER format.

ghost avatar Feb 22 '23 15:02 ghost

I was asking the name of the protocol you are trying to implement, i.e. where is that schema defined, and what protocol is it a message for?

tarcieri avatar Feb 22 '23 16:02 tarcieri

Ah - sorry. Misunderstood. We use X.509 and custom ones. But in X.509 you do not have application tags, I think. So maybe this is the wrong place, if you only implement features needed for cryptographic formats.

But anyway - thanks for the fast response. I'll close the issue then.

ghost avatar Feb 23 '23 08:02 ghost

We’re happy to accept PRs for additional functionality that goes beyond the formats we’re actively implementing. It’s just not something we’re planning on implementing ourselves any time soon

tarcieri avatar Feb 23 '23 14:02 tarcieri

I think the issue is still valuable because of the kerberos protocol requirement.

The remarkable thing is that it needs the APPLICATION as toplevel attribute, not field level.

zkonge avatar Sep 21 '23 21:09 zkonge