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

OpenType usage is not very clear #118

Closed
viraptor opened this issue Jan 8, 2018 · 2 comments
Closed

OpenType usage is not very clear #118

viraptor opened this issue Jan 8, 2018 · 2 comments

Comments

@viraptor
Copy link
Contributor

viraptor commented Jan 8, 2018

I'd like to use the type from rfc2459, which includes an opentype. I've got a AttributeTypeAndValue from which I'd like to decode the value. The only way I know to do it currently is somewhat awkward.

value_bytes = part['value'].asOctets()
spec = part.getComponentType()['value'].openType[part['type']]
value = decoder.decode(value_bytes, asn1Spec=spec)[0]

I couldn't find any way documented. Is there one?

@etingof
Copy link
Owner

etingof commented Jan 11, 2018

Ah, indeed!

You should just pass the decodeOpenTypes=True keyword parameter to main decode() function. It will automatically decode open types and replace Any fields with decoded structures.

I am going to document this shortly.

@etingof
Copy link
Owner

etingof commented Jul 9, 2019

Added some more docs and examples.

Sorry for it has taken so long!

@etingof etingof closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants