Giter Site home page Giter Site logo

tysonite / asn1-compiler Goto Github PK

View Code? Open in Web Editor NEW
44.0 8.0 11.0 1.58 MB

The ASN.1 compiler (from ASN.1 to C++) & runtime (BER / DER)

Home Page: http://tysonite.github.io/asn1-compiler/

License: Other

Shell 0.01% Java 17.17% CMake 6.58% C++ 75.36% Batchfile 0.01% ANTLR 0.88%
asn c-plus-plus ber der java x509 java-asn

asn1-compiler's Introduction

Build Status FOSSA Status Coverage Status Total alerts

Description

A compiler from ASN.1 to C++ code and run-time library for encoding/decoding data using BER/DER. Run-time library can be used independently from ASN.1 compiler.

Structure

The top directory consists of these sub-directories:

  • compiler -- A Java ASN.1 to C++ compiler
  • runtime -- C++ runtime library for encoding/decoding of the data

ASN.1 grammars

The Java ASN.1 to C++ compiler depends on JavaCC ASN.1 grammar, this grammar is a bit modified comparing to original one. It is far from complete (e.g. does not parse Information objects). However, ASN.1 compiler generates C++ code using that grammar.

An experimental Antlr4 ASN.1 grammar with partial support of notations from X.680, X.681, X.682 and X.683 is available as an option of ASN.1 compiler. Right now, compiler does not produce any C++ code if you this grammar is selected.

Examples

Several ASN.1 files and generated C++ code is available for protocols:

Compile & Test runtime library

The runtime library uses CMake to build itself. As a result of compilation static and shared libraries will be produced.

  1. Ensure that you are located in the directory with runtime library sources;
  2. Create a temporary build directory (e.g. build) with help of 'mkdir' command: mkdir build;
  3. Change current working to build directory: cd build;
  4. Execute CMake to create Makefile: cmake ..;
  5. Execute GNU make to build static and shared libraries: make;

Unit tests can be built during library compilation, if CMake command line contains option -DBUILD_UNIT_TESTS=1. Unit tests require Boost test framework, on Windows set environment variable BOOST_ROOT equal to your Boost installation path (e.g. BOOST_ROOT="c:\boost_1_55_0").

Coverage data can be calculated, if CMake command line contains option -DDO_COVERAGE=1. There is no need to specify -DBUILD_UNIT_TESTS=1 if you are going to see coverage data, because it will be enabled automatically. For example, to compile unit tests and collect coverage data during their running, execute cmake -DDO_COVERAGE=1 .. instead of command in step 4 above.

To run unit tests execute command: ./tests/TestBER.

Running ASN.1 compiler

  1. Move to compiler directory
  2. Execute mvn package
  3. Move to target directory if no errors
  4. Execute java -jar asn1-compiler-<...>.jar and follow on-screen instructions

Generate Debian/Ubuntu runtime package

The runtime library uses CPack (feature of CMake) to generate an installable Debian package. If compilation of runtime library was successful, execute make package to create package.

Donation

If this project helped you, please, consider to make a donation.

paypal

License

FOSSA Status

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.