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

Is it possible to get &[u8] for the underlying decoded value #245

Open
Fethbita opened this issue Apr 13, 2024 · 1 comment
Open

Is it possible to get &[u8] for the underlying decoded value #245

Fethbita opened this issue Apr 13, 2024 · 1 comment

Comments

@Fethbita
Copy link

I have a SignedData object from CMS and I decode bytes and validate all the fields one by one like in the tests. I also need to get the bytes of the certificate from the certificates and give it to boring for signature validation. I would not like to encode the parsed certificate again because I can't be sure if the encoded certificate will be the same as the parsed certificate.

It is possible to get into the bytes and parse it with some helper functions and get the certificate myself, but I would prefer to use rasn, is it possible to get the underlying bytes, just like the Content inside ContentInfo, i.e. using a function similar to as_bytes(), or what is the recommended way to get the bytes of a parsed object?

@XAMPPRocky
Copy link
Collaborator

To answer this, yes you can be sure that the encoding will match the input. DER is canonical meaning there is only one representation for it, if it was different then it would be a bug.

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

2 participants