Question

Is there a free package for reading, manipulating and writing ASN.1 in Java?

It must be:

  1. Free
  2. Lightweight
  3. Self-contained (without external dependencies on, e.g. Apache commons)
  4. Java 5 (not Java 6), and Java 4 is preferred.
Was it helpful?

Solution

The following project looks promising:

http://www.chaosinmotion.com/wiki/index.php?title=ASN.1_Library

It is provided under a liberal BSD-style licence.

It is small, 41 classes compiling to 55KiB.

It compiled clean with no dependencies to Java 3.

OTHER TIPS

The free BouncyCastle library provides low-level ASN.1 parsing. You don't need to install BC as a provider to use the ASN.1 capabilities. It has different versions for 1.4 and up. It has no external dependencies. As the default bundle contains all of the BC provider classes, you may want to repackage it if you want something more compact.

You could use jASN1. It is licensed under LGPL and should satisfy all of your needs. It is also very efficient.

I need to be able to parse any kind of ASN.1 data in krypt. Although krypt is a Ruby project, you may want to have a look at the JRuby extension - the code for handling ASN.1 parsing/encoding is written entirely in Java and modular enough for easy extraction.

I also made a Java-only version, but it is missing some of the higher-level functionality of the former. But since it's concise, maybe it's a good opportunity to get you started.

Both are free of any additional dependencies and use only standard JDK functionality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top