All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.asn1.DerCoder

java.lang.Object
   |
   +----iaik.asn1.DerCoder

public final class DerCoder
extends Object
The DerCoder objects are strategy objects that are able to convert ASN.1 objects into DER encoded byte arrays and vice versa.


Constructor Index

 o DerCoder()

Method Index

 o decode(byte[])
Creates an ASN.1 object from the BER encoded version.
 o decode(InputStream)
Creates an ASN.1 object from the BER encoded version.
 o encode(ASN1Object)
Returns the ASN.1 DER encoded version of the given ASN.1 object as a byte array.

Constructors

 o DerCoder
 public DerCoder()

Methods

 o encode
 public static byte[] encode(ASN1Object object)
Returns the ASN.1 DER encoded version of the given ASN.1 object as a byte array. The encoding algorithm encodes the values in tail recursive order, starting from the last lower level object. In this way we can calculate the encoded data lengths accurately and "for free".

Parameters:
object - the ASN.1 object to encode
Returns:
the DER encoded version of the ASN.1 object as byte array
 o decode
 public static ASN1Object decode(byte coding[]) throws CodingException
Creates an ASN.1 object from the BER encoded version.

Parameters:
coding - the array containing the DER encoded ASN.1 object
Returns:
the DER encoded array as ASN1Object
Throws: CodingException
if there is an error while decoding
 o decode
 public static ASN1Object decode(InputStream is) throws CodingException, IOException
Creates an ASN.1 object from the BER encoded version.

Parameters:
is - the InputStream with the DER encoded ASN.1 object
Returns:
the DER encoded array as ASN1Object
Throws: CodingException
if there is an error while decoding
Throws: IOException
if there is an error with the InputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index