anon.crypto
Class AbstractX509Extension

java.lang.Object
  extended by anon.crypto.AbstractX509Extension
Direct Known Subclasses:
AbstractX509AlternativeName, AbstractX509KeyIdentifier, X509BasicConstraints, X509CertificateIssuer, X509IssuingDistributionPoint, X509KeyUsage, X509UnknownExtension

public abstract class AbstractX509Extension
extends java.lang.Object

Represents and creates an X509 V3 extensions. The concrete extensions are subclasses of this class and must (!) implement the IDENTIFIER String constant and a public (!) constructor that takes a DERSequence.

Author:
Rolf Wendolsky
See Also:
http://www.faqs.org/rfcs/rfc3280.html

Field Summary
private static java.lang.Class[] AVAILABLE_EXTENSIONS
           
static java.lang.String IDENTIFIER
          Each subclass must contain this individual identifier.
private  boolean m_critical
           
private  org.bouncycastle.asn1.DERSequence m_extension
           
private  org.bouncycastle.asn1.DERObjectIdentifier m_identifier
           
private  byte[] m_value
           
private static java.util.Vector ms_classExtensions
           
 
Constructor Summary
AbstractX509Extension(org.bouncycastle.asn1.DERSequence a_extension)
          Creates an extension from a BouncyCastle DER sequence.
AbstractX509Extension(java.lang.String a_identifier, boolean a_critical, byte[] a_value)
          Create a new X509 V3 extension.
 
Method Summary
 boolean equals(java.lang.Object a_object)
          Two extensions are equal if their identifiers are equal.
(package private)  org.bouncycastle.asn1.DERSequence getBCExtension()
          Returns the extension as BouncyCastle DERSequence.
 byte[] getDEROctets()
          Returns the DER value of this extension in a single byte array.
 java.lang.String getIdentifier()
          Returns the identifier of this extension.
(package private) static AbstractX509Extension getInstance(org.bouncycastle.asn1.DERSequence a_extension)
          Creates an extension from a BouncyCastle DER sequence.
abstract  java.lang.String getName()
          Returns the human-readable name of this extension.
abstract  java.util.Vector getValues()
          This method returns all values of this extension in separated String objects.
 int hashCode()
          The hash code is derived from the identifier.
 boolean isCritical()
          Returns if the extension is critical.
 java.lang.String toString()
          Returns the name of this extension.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final java.lang.String IDENTIFIER
Each subclass must contain this individual identifier.


AVAILABLE_EXTENSIONS

private static java.lang.Class[] AVAILABLE_EXTENSIONS

ms_classExtensions

private static java.util.Vector ms_classExtensions

m_identifier

private org.bouncycastle.asn1.DERObjectIdentifier m_identifier

m_critical

private boolean m_critical

m_value

private byte[] m_value

m_extension

private org.bouncycastle.asn1.DERSequence m_extension
Constructor Detail

AbstractX509Extension

public AbstractX509Extension(java.lang.String a_identifier,
                             boolean a_critical,
                             byte[] a_value)
Create a new X509 V3 extension.

Parameters:
a_identifier - the identifier of this extension
a_critical - boolean
a_value - the extension's value

AbstractX509Extension

public AbstractX509Extension(org.bouncycastle.asn1.DERSequence a_extension)
Creates an extension from a BouncyCastle DER sequence. For internal use only. Each subclass must contain this constructor in the following form:
 X509UnknownExtension(DERSequence a_extension)
 {
    super(a_extension);
 }
 

Parameters:
a_extension - a DERSequence
Method Detail

getInstance

static AbstractX509Extension getInstance(org.bouncycastle.asn1.DERSequence a_extension)
Creates an extension from a BouncyCastle DER sequence. For internal use only.

Parameters:
a_extension - a DERSequence
Returns:
a X509Extension

getName

public abstract java.lang.String getName()
Returns the human-readable name of this extension.

Returns:
the human-readable name of this extension

isCritical

public final boolean isCritical()
Returns if the extension is critical.

Returns:
true if the extension is critical; false otherwise

getIdentifier

public final java.lang.String getIdentifier()
Returns the identifier of this extension.

Returns:
the identifier of this extension

getDEROctets

public final byte[] getDEROctets()
Returns the DER value of this extension in a single byte array.

Returns:
the DER value of this extension in a single byte array

hashCode

public final int hashCode()
The hash code is derived from the identifier.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

equals

public final boolean equals(java.lang.Object a_object)
Two extensions are equal if their identifiers are equal.

Overrides:
equals in class java.lang.Object
Parameters:
a_object - an Object
Returns:
true if the object is an extension and their identifiers are equal; false otherwise

getValues

public abstract java.util.Vector getValues()
This method returns all values of this extension in separated String objects. The values should be human readable.

Returns:
all values of this extension

toString

public final java.lang.String toString()
Returns the name of this extension.

Overrides:
toString in class java.lang.Object
Returns:
the name of this extension

getBCExtension

final org.bouncycastle.asn1.DERSequence getBCExtension()
Returns the extension as BouncyCastle DERSequence.

Returns:
the extension as BouncyCastle DERSequence