FreeDSx / ASN1

An ASN.1 Library for PHP.
MIT License
10 stars 3 forks source link

OID prefix starting with dot #4

Closed simPod closed 5 years ago

simPod commented 5 years ago

Sometimes SNMP oids gets prefixed with .1.3.6.1 and sometimes with 1.3.6.1

However https://github.com/FreeDSx/ASN1/blob/master/src/FreeDSx/Asn1/Encoder/BerEncoder.php#L725 can work only with the latter so calling it fails on Warning: A non-numeric value encountered

ChadSikorra commented 5 years ago

Thanks for reporting this. I decided to solve it in the SNMP library instead: https://github.com/FreeDSx/SNMP/commit/ea41da7f35fdce1a1697432088a9265a8e70f890. As that convention seems specific to SNMP for whatever reason.

I'm not sure where the leading dot format started. I have never seen it mentioned in any official SNMP RFCs or the ASN.1 docs (X.680, X.690). I could probably add more checks to the validity of a string OID format, but I try not to do too much of that in the encoder since it would start to impact performance on large sets of data.

simPod commented 5 years ago

Cool, thanks, will test it as soon as I get to it. Talking about the convention, you know SNMP, every enterprise has its own MIB for everything 😅 Things are done multiple ways even using OIDs.

On Thu, Feb 7, 2019, 05:12 Chad Sikorra <notifications@github.com wrote:

Thanks for reporting this. I decided to solve it in the SNMP library instead: FreeDSx/SNMP@ea41da7 https://github.com/FreeDSx/SNMP/commit/ea41da7f35fdce1a1697432088a9265a8e70f890. As that convention seems specific to SNMP for whatever reason.

I'm not sure where the leading dot format started. I have never seen it mentioned in any official SNMP RFCs or the ASN.1 docs (X.680, X.690). I could probably add more checks to the validity of a string OID format, but I try not to do too much of that in the encoder since it would start to impact performance on large sets of data.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FreeDSx/ASN1/issues/4#issuecomment-461282265, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUAJWe9p_K3MNul2jrxbNBESXDEx1qYks5vK6e1gaJpZM4alBM3 .