Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

der: implementing other tag classes than Context-Specific #877

Open
ghost opened this issue Feb 22, 2023 · 7 comments
Open

der: implementing other tag classes than Context-Specific #877

ghost opened this issue Feb 22, 2023 · 7 comments

Comments

@ghost
Copy link

ghost commented Feb 22, 2023

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?

pub(crate) enum Tag {

@tarcieri
Copy link
Member

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?

@ghost
Copy link
Author

ghost commented Feb 22, 2023

I am trying to implement that in DER format.

@tarcieri
Copy link
Member

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?

@ghost
Copy link
Author

ghost commented Feb 23, 2023

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 ghost closed this as completed Feb 23, 2023
@tarcieri
Copy link
Member

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

@zkonge
Copy link
Contributor

zkonge commented Sep 21, 2023

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.

@tarcieri tarcieri reopened this Sep 22, 2023
@tarcieri tarcieri changed the title Implementing other tag classes than context-specific der: implementing other tag classes than Context-Specific Aug 18, 2024
@dishmaker
Copy link

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

Here's an example of top-level tag:

formats/der/tests/derive.rs

Lines 556 to 562 in fd9b041

/// EU Tachograph certificate
pub type TachographCertificate<'a> = ApplicationImplicit<33, TachographCertificateInner<'a>>;
/// EU Tachograph certificate inner sequence
#[derive(Sequence)]
#[asn1(tag_mode = "IMPLICIT")]
pub struct TachographCertificateInner<'a> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants