de.flexiprovider.common.util
Class ASN1Tools

java.lang.Object
  |
  +--de.flexiprovider.common.util.ASN1Tools

public final class ASN1Tools
extends java.lang.Object

ASN.1 utility class. Used to translate between FlexiBigInt and BigInteger types. Provides DER encoding and decoding methods.

Author:
Martin Döring

Method Summary
static codec.asn1.ASN1Integer createInteger(FlexiBigInt value)
          Create a new ASN1Integer from the given FlexiBigInt value.
static void derDecode(byte[] encoding, codec.asn1.ASN1Type type)
          Decode the given DER encoded ASN.1 structure.
static byte[] derEncode(codec.asn1.ASN1Type type)
          DER encode the given ASN.1 structure.
static FlexiBigInt getFlexiBigInt(codec.asn1.ASN1Integer value)
          Get the FlexiBigInt value from the given ASN1Integer.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInteger

public static codec.asn1.ASN1Integer createInteger(FlexiBigInt value)
Create a new ASN1Integer from the given FlexiBigInt value.
Parameters:
value - the FlexiBigInt value
Returns:
a new ASN1Integer holding the FlexiBigInt value

getFlexiBigInt

public static FlexiBigInt getFlexiBigInt(codec.asn1.ASN1Integer value)
Get the FlexiBigInt value from the given ASN1Integer.
Parameters:
value - the ASN1Integer
Returns:
the FlexiBigInt value stored in the ASN1Integer

derEncode

public static byte[] derEncode(codec.asn1.ASN1Type type)
DER encode the given ASN.1 structure.
Parameters:
type - the ASN.1 structure
Returns:
the DER encoded ASN.1 structure

derDecode

public static void derDecode(byte[] encoding,
                             codec.asn1.ASN1Type type)
                      throws codec.asn1.ASN1Exception,
                             java.io.IOException
Decode the given DER encoded ASN.1 structure.
Parameters:
encoding - the encoded ASN.1 structure
type - the type holding the decoding
Throws:
java.io.IOException - on decoding errors.
codec.asn1.ASN1Exception - on decoding errors.