edu.vt.middleware.crypt.util
Class DERHelper

java.lang.Object
  extended by edu.vt.middleware.crypt.util.DERHelper

public final class DERHelper
extends Object

Utility class with methods to facilitate common operations on BouncyCastle DEREncodable objects.

Version:
$Revision: 1818 $
Author:
Middleware Services

Method Summary
static int asInt(org.bouncycastle.asn1.DEREncodable e)
          Extracts the integer value from a DERInteger.
static byte[] asOctets(org.bouncycastle.asn1.DEREncodable e)
          Extracts the octet string (byte array) from a DEROctetString.
static org.bouncycastle.asn1.DERObject toDERObject(byte[] data, boolean discardWrapper)
          Attempts to create a Bouncy Castle DERObject from a byte array representing ASN.1 encoded data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asInt

public static int asInt(org.bouncycastle.asn1.DEREncodable e)
Extracts the integer value from a DERInteger.

Parameters:
e - DERInteger instance.
Returns:
Integer value.

asOctets

public static byte[] asOctets(org.bouncycastle.asn1.DEREncodable e)
Extracts the octet string (byte array) from a DEROctetString.

Parameters:
e - DEROctetString instance.
Returns:
Bytes of octet string value.

toDERObject

public static org.bouncycastle.asn1.DERObject toDERObject(byte[] data,
                                                          boolean discardWrapper)
                                                   throws IOException
Attempts to create a Bouncy Castle DERObject from a byte array representing ASN.1 encoded data.

Parameters:
data - ASN.1 encoded data as byte array.
discardWrapper - Set to true to decode the octets of a DER octet string as DER encoded data, thereby discarding the wrapping DER octet string, false otherwise. Has no effect on other types of DER-encoded data.
Returns:
DER object.
Throws:
IOException - On I/O errors.


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.