Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Add support for context specific types #16

Closed
huysentruitw opened this issue Aug 13, 2018 · 3 comments
Closed

Add support for context specific types #16

huysentruitw opened this issue Aug 13, 2018 · 3 comments
Assignees

Comments

@huysentruitw
Copy link
Owner

See #9

@huysentruitw
Copy link
Owner Author

huysentruitw commented Aug 14, 2018

From https://docs.ldap.com/ldap-sdk/docs/ldap-wire-protocol-reference/asn1-ber.html, http://luca.ntop.org/Teaching/Appunti/asn1.html and others, I've learned that the current implemented ASN.1 types (Boolean, Integer, Null, etc) are only valid within the universal class range and not for the application or context-specific class, where the tag identifier has a different meaning.

Will probably have to refactor the DerAsnType base class and additionally add the possibility to register class-specific parsers.

cc @qmfrederik

@huysentruitw
Copy link
Owner Author

Refactor finished (v3.0)

@cleftheris
Copy link

Hi and thanks for your efforts. Is there an example for how todo this?
I have case where I am creating a DerAsnIa5String and serializes perfectly!

var contextSpesificId = new DerAsnIdentifier(DerAsnTagClass.ContextSpecific, DerAsnEncodingType.Primitive, DerAsnKnownTypeTags.Primitive.ObjectIdentifier);
var location = new DerAsnIa5String(contextSpesificId, uri.ToString());
// etc....

But cant seem to get the value out. I tried to hack my way through by doing Encoding.ASCII.GetString(objectIdentifier.Value.Select(x => (byte)x).ToArray()) which gives me almost the string I wanted with missing one character plus two control characters at the begining. Did not like this approach anyway.

What i am trying to figure out is how to tell the default decoder not to parse this into DerAsnObjectIdentifier if it sees the DerAsnTagClass.ContextSpecific but instead parse it into DerAsnIa5String. Can it be done?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants