-
Notifications
You must be signed in to change notification settings - Fork 20
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 Support #10
Comments
Hi there, I'd suggest the following steps in implementing DER support:
Feel free to contribute via PRs whenever you like to :) |
…exity The current approach to generate the (de-)serialization code is to messy, too hard to understand, too hard to extend and too complex. The new idea is to introduce a further codegen step. 1) ASN Definition -- old codegen --> 3) Rust struct with (de-)serializable | A | generate proc-macro | V | 2) Rust struct with attributes and that pleasant for human eyes Instead of writing 3) to the user file, 2) shall now be written instead. Also, instead of generate comple (de-)serializ code in 3), the Visitor pattern is being used to walk the types and values on the generated data types. This hopefully allows to implement UPER, PER, BER, ... #1 #10 #11
@masihyeganeh I suggest to await the current refactoring (see #11) which should make it easy-ish to extend this crate with another encoding (DER in your case) and without the need to codegen for it. |
Hi there, refactoring is almost complete. I'll get rid of (the) old (uper) code soon/next. If you want to, you can look into implementing a I guess some ASN syntax and types you'll need are not parsed or implemented yet. If you show some samples I'll might focus on them next. Otherwise I'll probably keep on trying to get LDAP working next. I'll gladly accept a PR for a working implementation 😃 |
Fantastic. |
@masihyeganeh I just did, but I would also like to know why it did not work for you. Maybe its and issue with my repository layout? If so, I might be able to fix it, if you are give me a more concrete error description. |
Thanks. |
I just started to implement DER, but I think I'm lost. Line 27 in e9ac059
It is not clear to me how to implement it, what files I need to change and ... And by the way, I tested your |
I just added the der-support branch where I copied the UPER related modules for DER. Let me explain real quick:
Depending on how similar the DER/(u)PER traits are, I will/we can try to unify them later. But I suggest to 'just get it working' for now - even if this means duplicat-ish code/declarations atm. Refactoring working code with proper tests is much easier than trying to get the structure, abstraction and impl right at once. I hope this helps you to get you going 😄 EDIT: regarding the |
Thanks man. Look, der (and ber and cer) is way simpler than uper; That's all. Nothing more. No especial case or anything. I'm sure you can implement it in minutes, but I had to read your code for hours to know what is going on. If you can give some of your time, here is a simple explaiantion of ber implementation (der is just ber, but simpler, always there is length): Or if you don't have time, please guide me through it. |
…pe, fixes #13 Resolve all tags while augmenting the annotated structs with Constraint impls. It is neccessary that to this state, the complex-type-references have already resolved their tags. For this it it might be neccessary from now on to have all *.asn1 files and their modules in scope while resolving the tags in the RustModel-to-Annotation stage. Quite a bit of work went into ensuring that no unncessary tags (meaning default tags) are present in the annotated representation to prevent unnecessary bloat. This will probably allow the SET and SET_OF branch to be merged soon #11 #10
@kellerkindt @masihyeganeh Any update on this? It would be great to have Rust code for DER encoding/decoding generated directly from the ASN.1 files. |
So, I've set up a basic workflow for the (Distinguished) Encoding Rules support, see the very very early boolean example I noticed the https://asn1.io/asn1playground is now rate limited pretty early, which makes it hard for me to verify my implementations. Does anybody know an alternative for DER? EDIT: Started to use asn1js as reference |
Please consider https://GitHub.com/mouse07410/asn1c, as a cross-testing platform. |
Hi.
My project heavily depends on parsing DER encoded data.
Your crate is by far the most interesting ASN1 parsers.
Is it hard to implement DER for it too?
I can contribute to that but I'm not sure where to start.
The text was updated successfully, but these errors were encountered: