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
Derive a SEQUENCE OF SEQUENCE? #232
Comments
Sure, this is very much possible! #[derive(asn1::Asn1Read, asn1::Asn1Write, Hash, PartialEq, Clone)]
pub(crate) struct TbsCertificate<'a> {
// ...
extensions: Option<asn1::SequenceOf<'a, Extension<'a>>>,
}
#[derive(asn1::Asn1Read, asn1::Asn1Write, PartialEq, Hash, Clone)]
pub(crate) struct Extension<'a> {
pub(crate) extn_id: asn1::ObjectIdentifier<'a>,
#[default(false)]
pub(crate) critical: bool,
pub(crate) extn_value: &'a [u8],
} Does that answer your question? |
Or if you've really just got |
I believe this does answer my question, I'll try this out. Thanks!! |
Yep looks like it worked, thanks so much! |
My pleasure! If you have suggestions for how the docs could be more clear, please shout them out! |
I do have one more question! Is it possible to create a new SequenceOf from like a Vec or similar that I can then serialize back to asn1? I've successfully parsed asn1 and gotten a SequenceOf from it, but I can't figure out how to modify the data within and round-trip it back to asn1; if I iterate over it, it of course consumes the elements and I end up serializing an empty SequenceOf back to asn1. |
SequenceOfWriter is probably what you want.
בתאריך יום ג׳, 30 בנוב׳ 2021, 16:17, מאת Josh Watson <
***@***.***>:
… I do have one more question! Is it possible to create a new SequenceOf
from like a Vec or similar that I can then serialize back to asn1? I've
successfully parsed asn1 and gotten a SequenceOf from it, but I can't
figure out how to modify the data within and round-trip it back to asn1; if
I iterate over it, it of course consumes the elements and I end up
serializing an empty SequenceOf back to asn1.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#232 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAGBD7KEZIY5MNUYFWYHDUOU5ODANCNFSM5IC23OIA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I was able to derive some structs that deserialize correctly, but I'm struggling to figure out how to represent a SEQUENCE OF SEQUENCE in a struct. Is there an example of this anywhere? Is it possible, or do I need to write my own code with a
d.read_element::<asn1::SequenceOf>()
to do this?The text was updated successfully, but these errors were encountered: