Is there a free package for reading, manipulating and writing ASN.1 in Java? [closed]
Asked Answered
A

5

8

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.
Arawak answered 1/5, 2009 at 20:22 Comment(0)
A
5

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.

Arawak answered 14/5, 2009 at 1:2 Comment(1)
Since that link seems to have rotted away: The sources are at chaosinmotion.com/sources/asn.1.zipToreutics
N
2

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.

Naturalize answered 1/5, 2009 at 20:30 Comment(5)
It's a viable option, but it doesn't really seem to meet the light-weight requirement (I consider light-weight to be under 50K).Arawak
Yes, I wrote my own decoder class. It's about 200 lines of code, maybe. I've been using it for over 10 years, and I'd like to refactor it to provide a different interface, but it has definitely met the need.Naturalize
@Erickson: Any chance you want to share it? (Although it is a low priority for me now that I have resolved my immediate problems with a PKCS#12 keystore, so no rush).Arawak
Looking more closely at BC, it's a looonnnggg way from light-weight (nearly 400 classes - and separating out the non-core classes from core would be a lot of work).Arawak
The code I wrote already is not mine to share. But I am thinking about writing my own decoder that would be event-oriented, like a SAX parser. If I do that I would be willing to share.Naturalize
L
2

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

Library answered 18/6, 2012 at 18:24 Comment(0)
A
0

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.

Activity answered 30/4, 2012 at 12:16 Comment(0)
L
0

I had basically the same set of requirements and found this asn-one - ASN.1 library for Java perfect for my case.

  • It's Apache 2.0 License
  • Pretty small (65 KiB)
  • It's Java 7+ compatible, however. That may not be a major problem for most projects nowadays.
Laoag answered 29/6 at 19:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.