librasn / rasn

A Safe #[no_std] ASN.1 Codec Framework
Other
183 stars 43 forks source link

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

Open Fethbita opened 2 months ago

Fethbita commented 2 months ago

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?