Demonstrates using the decode function of the native asn1_codec executable from a Java program.
The Dockerfile builds a single image containing both the native and Java apps. The Java app calls the native executable synchronously, as an OS process, passing the input as a file. It does NOT use JNI, and Kafka is not required. The native app does not run continuously but works similar to a command-line app with one process per invocation that returns the output and exits.
The only change to the asn1_codec native code needed to get this to work was a slight tweak to the `ASN1_Codec::filetest()' function to make it produce decoded output directly to stdout instead of only logging it.
- Docker
Clone the repository including submodules:
git clone --recurse-submodules https://github.com/iyourshaw/asn1-codec-java.git
Build and run the Docker image:
cd asn1-codec-java
docker compose up --build -d
Open a browser and navigate to:
Click one of the buttons to load an example message, or paste UPER hex into the text area, then click "Decode".
- Add a REST API.
- Add option to produce JSON output (JER and ODE JSON).
- Make the executable location configurable.
- Add an encode function.
- asn1_codec has been tested and is known to build and run on the following OSs:
- Alpine Linux 3.12 - use
Dockerfile
(It does not work on the latest Alpine, 3.19 as of May 2024) - Amazon Linux 2023 - use
Dockerfile.amazonlinux
(It does not work on Amazon Linux 2 due to an older glibc version)
- Alpine Linux 3.12 - use