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

OID Decoding/Encoding is wrong #8

Closed
danielmarschall opened this issue Sep 17, 2020 · 4 comments
Closed

OID Decoding/Encoding is wrong #8

danielmarschall opened this issue Sep 17, 2020 · 4 comments

Comments

@danielmarschall
Copy link

Hello,

I noticed that the BerEncoder::decodeOid() and BerEncoder::encodeOid() functions are not correctly implemented.

The formula "modulo 40" is only correct for the root OIDs 0 and 1. For 2, the procedure becomes more complex.
More information at: https://misc.daniel-marschall.de/asn.1/oid_facts.html

Example:
Your program is not able to handle th OID 2.999

Here is a tool that you can use to test if your implementation is correct:
https://misc.daniel-marschall.de/asn.1/oid-converter/online.php

@ChadSikorra
Copy link
Contributor

Hi @danielmarschall, thanks for reporting this issue. Indeed, looking at the x.690 spec, I am not handling that properly. They also include an example of how it should be encoded as well. I will work on it this week.

@ChadSikorra
Copy link
Contributor

I think this should be resolved with b854cf1. I have tagged a new version with the fixes.

@ChadSikorra
Copy link
Contributor

I thought of yet another case where I could potentially not be handling the encoding of the second OID component properly now when it reaches near the PHP_MAX_INT value. That has been resolved with 05206bf.

@ChadSikorra
Copy link
Contributor

Considering this resolved. If you still notice issues please feel free to re-open it or let me know. Thanks again for reporting this.

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

No branches or pull requests

2 participants