> Hello,
> I would like to parse a DER encoded file ; can any
> one forward me on how to do that in java.
> best regards
I have found three ways of doing that...
1) you can get a DER Compiler and parse the file using that compiler. It will generate Java classes for you with encode and decode functions... the easiest compiler to use, that I came across is Objective Systems' ASN1C compiler...
2) the second way of doing it is through run time APIs... RSA's JsafeJCE provider has APIs for doing run time DER encoding and decoding based on user defined DER structure...
3) since DER does nothing but appends tag and data length information to the information you are trying to send, you can write your own code to encode and decode a DER stream...
hope this helps...
Before going with 3), do check if any of the available implementations suite you. There are the Bouncy Castle Crypto APIs (http://www.bouncycastle.org/) which contain, among other things, a library for reading/writing ASN.1 objects (both DER and CER are ASN.1 encoded files)
Kind regards,
Anestis
> Before going with 3), do check if any of the
> available implementations suite you. There are the
> Bouncy Castle Crypto APIs
> (http://www.bouncycastle.org/) which contain, among
> other things, a library for reading/writing ASN.1
> objects (both DER and CER are ASN.1 encoded files)
>
> Kind regards,
> Anestis
I concur... use 3) only if 1) and 2) fail as it will take more effort and the solution might not be portable...