Giter Site home page Giter Site logo

Comments (4)

dirmgr avatar dirmgr commented on September 13, 2024

It is correct that the LDAP SDK does not support multi-byte BER types. However, I am not aware of any case in which LDAP communication makes use of multi-byte types. The LDAP SDK's ASN.1 support is primarily intended for use in conjunction with LDAP and does not attempt to provide general-purpose ASN.1 support. Is there an LDAP-specific use case that requires multi-bye type support?

from ldapsdk.

myroch avatar myroch commented on September 13, 2024

yes, that's true, I wanted to use your sdk for pure ASN.1 parsing. But LDAP RFC clearly specifies ASN.1 BER limitations in LDAP protocol - one byte types are not there :-)

from ldapsdk.

vdailly avatar vdailly commented on September 13, 2024

For sure this is rarely found :)
But it can be found in the Microsoft LDAP world :)
Especially on the LDAP_SERVER_GET_STATS_OID in the response to the control described, provided the server is at least 2008 or later and a specific flag is set in the request control.

The BER encoding of the following ASN.1 structure:
StatsResponseValueV4 ::= SEQUENCE OF SEQUENCE {
statisticName OCTET STRING
CHOICE {
intStatistic [0] INTEGER
stringStatistic [1] OCTET STRING
}
}

For sure this is not a control used a lot. And even the .NET API does not provide any method to correctly decode this sequence. At least in the System.DirectoryServices.Protocols namespace.

from ldapsdk.

dirmgr avatar dirmgr commented on September 13, 2024

There's nothing in the example that you've provided that would require a multi-byte BER type.

First, the simple elements: The outer SEQUENCE and each inner SEQUENCE will have a type of 0x30. The statisticName OCTET STRING will have a type of 0x04.

The CHOICE component is only slightly more complicated. The value can either be an integer or an octet string, and which one is actually used is indicated by the BER type of the element. In this case, the definition provides the tag number to use, and it's provided alone surrounded by square brackets, which means that it uses the context-specific class. Both of the options (INTEGER and OCTET STRING) are primitives, so this encoding is also pretty straightforward: you'd use 0x80 to denote an intStatistic and 0x81 to denote a stringStatistic.

The issue with a multi-byte type would only arise if you need to use a tag number that is greater than or equal to 31. The LDAP SDK doesn't currently support that, but I've never encountered a case in which it has been needed.

from ldapsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.