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

Provide as_raw for all DER components? #40

Open
chifflier opened this issue Jul 8, 2020 · 4 comments
Open

Provide as_raw for all DER components? #40

chifflier opened this issue Jul 8, 2020 · 4 comments

Comments

@chifflier
Copy link
Member

This is the tracking issue for ideas discussed with @g2p in #35: can the parser expose the raw bytes for all components?

Maybe a possibility is to use something like nom-locate to parse items while tracking location in the input stream.

@kpp
Copy link
Contributor

kpp commented Jul 9, 2021

Hey! I would love to have this API. Would you please implement it?

@nthuemmel-scontain
Copy link
Contributor

This would be very helpful to extract the DER-serialization of individual certificate components - in my case, having access to the DER-encoding of SubjectPublicKeyInfo would be great to achieve interoperability with another crate.

@cpu
Copy link
Collaborator

cpu commented Jan 8, 2024

in my case, having access to the DER-encoding of SubjectPublicKeyInfo would be great to achieve interoperability with another crate.

@nthuemmel-scontain For this particular use case you should be able to use the raw field of the SubjectPublicKeyInfo struct:

A raw unparsed PKIX, ASN.1 DER form (see RFC 5280, Section 4.1).

@nthuemmel-scontain
Copy link
Contributor

@nthuemmel-scontain For this particular use case you should be able to use the raw field of the SubjectPublicKeyInfo struct:

Thank you! You are right! For some reason, I assumed raw would cover only the subject_public_key, but it does indeed also cover the algorithm identifier. I guess I got confused by the mention of the parsed() method in the docs. (My assumption being that algorithm and subject_public_key cannot be the parsed equivalent of raw if there exists a separate fallible parsed() method.)

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

4 participants