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

Indefinite length values #2

Open
dimuls opened this issue Apr 13, 2020 · 6 comments · May be fixed by #4
Open

Indefinite length values #2

dimuls opened this issue Apr 13, 2020 · 6 comments · May be fixed by #4

Comments

@dimuls
Copy link

dimuls commented Apr 13, 2020

Can you implement indefinite length values, please?

@geoffgarside
Copy link
Owner

Is this already implemented in the Golang encoding/asn1 package? If not, can you point me to the specs for it?

@dimuls
Copy link
Author

dimuls commented Apr 14, 2020

No, it isn't. There is abandoned implementation https://go-review.googlesource.com/c/go/+/13746 which i have found. But it seems not working well: it doesn't parse BER data i need.

Spec is T-REC-X.690-201508-I!!PDF-E.pdf, it starts from 8.1.3.1.

@geoffgarside
Copy link
Owner

geoffgarside commented Apr 16, 2020

Thanks, I'm getting the code cleaned up and brought up to date for 1.14 first, then I'll start looking at this.

You mentioned the abandoned implementation wasn't parsing the BER data you need it to. Do you have any examples of the bytes and expected output you can share? (there may be some in the PDF, I've not looked yet)

@dimuls
Copy link
Author

dimuls commented Apr 16, 2020

I wrote my own implementation of indefinite length values (based on abandoned implementation which i mentioned above) but i'm not sure if it will work in all cases.

About examples: i can't share them due to legal restrictions, but the main problem was in alignment zeros in files (which is not in BER specification). Second problem was fixed by removing all DER restrictions from parseTagAndLength function.

If you will implement BER with indefinite lengths i can help with testing it on my files.

@geoffgarside geoffgarside linked a pull request Apr 28, 2020 that will close this issue
@geoffgarside
Copy link
Owner

Can you have a look at #4 when you get a chance

@dimuls
Copy link
Author

dimuls commented May 4, 2020

I decided to write my own BER parser because using golang DER based parser it is hard to parse CHOICE type (which is common in my data). Anyway, thank you, maybe some one will find this useful.

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

Successfully merging a pull request may close this issue.

2 participants