Giter VIP home page Giter VIP logo

asn1's People

Contributors

chadsikorra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

asn1's Issues

Add a Parser / Compiler for ASN.1 Files

It would be very handy to have a compiler capable of parsing ASN.1 files to PHP classes. And then using those PHP classes to build the requisite ASN.1 data structures to be encoded. Or take an encoded ASN.1 data structure and translate that to the PHP classes that were built.

I also have a need for general ASN.1 parsing in the SNMP library for MIBs to pick apart the generated AST (a subset anyway). This requires a parser based off X.680, and several other components:

  • Create a Lexer / Tokenizer for ASN.1 syntax based on X.680
  • Create a parser / AST generator from the tokenization
  • Create a compiler for translating to / from PHP classes based on the parsed ASN.1.

OID Decoding/Encoding is wrong

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

Problem with Length check?

Hi,

i use the ASN1 and LDAP lib to proxy between a Server and a Client. On both sides i had some Problems with some LDAP-Messages.

It seems the encoder/decoder did not continue with some messages because they were to short. It got stuck in BerEncoder.php in decodeLongDefiniteLength()

        if (($lengthOfLength + 1) > ($this->maxLen - $this->pos)) {
            throw new PartialPduException('Not enough data to decode the length.');
        }

In Wireshark everything looks okay.

It works when i remove the "+ 1" from the code.

Tobias

Encoder Memory Issues

When decoding a large ASN.1 structure the encoder seems to use an unusually large amount of memory which can completely exhaust the default memory limit in PHP. This is likely due to the use of the encoders substr usage while chunking up the binary data and not releasing it in certain spots. Need to take a closer look on how to improve this.

A better way to validate ASN.1 structures

Currently validating an ASN.1 structure is quite a pain. It requires a lot of manual effort. There should be a object-oriented way to build up a list of requirements that the structure must adhere to, then evaluate an existing ASN.1 type against those rules. This would eliminate a lot of error-prone loops and individual checks after constructing a structure from binary form.

Implement a CER Encoder

A lot of the work is already done in both the BER encoder and the CerDerTrait. The largest issue to implementation is the indefinite encoding and how to handle that in the encoding/decoding process.

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.