All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.x509.X509Extensions

java.lang.Object
   |
   +----iaik.x509.X509Extensions

public class X509Extensions
extends Object
This class is used to deal with X.509v3 extensions. This class consits of two parts: Every class which implements a specific extension must first register itself.
  private static ObjectID oid = new ObjectID("2.5.29.18");
  static {
    Class _IssuerAltName = new IssuerAltName().getClass();
    X509Extensions.register(oid, _IssuerAltName);
  }
 
To use the extension management you should subclass X509Extensions.

See Also:
X509Certificate, RevokedCertificate, CRL

Constructor Index

 o X509Extensions()
Default Constructor.

Method Index

 o addExtension(V3Extension)
Adds an extension.
 o countExtensions()
Returns the number of extensions.
 o create(ObjectID)
Returns the implementation of the specified extension defined through an ASN.1 ObjectID.
 o createExtensions()
Creates an ASN1Object with the extensions.
 o getExtension(ObjectID)
Returns a specific extension.
 o hasExtensions()
Checks, if there are any extensions.
 o listExtensions()
Lists all extensions.
 o parseExtensions(ASN1Object)
Initializes the extensions from an ASN1Object.
 o register(ObjectID, Class)
Registers a new implementation for a v3 certificate extension.
 o removeAllExtensions()
Removes all extensions.
 o removeExtension(ObjectID)
Removes an extension.
 o showExtensions()
Returns a string that represents the contents of the extensions.

Constructors

 o X509Extensions
 public X509Extensions()
Default Constructor.

Methods

 o create
 public static V3Extension create(ObjectID oid) throws InstantiationException
Returns the implementation of the specified extension defined through an ASN.1 ObjectID.

Parameters:
oid - the ObjectID of the extension.
Returns:
the implementation of the extension with this oid
Throws: InstantiationException
if the internal factory couldn't create an instance of requested type
 o register
 public static void register(ObjectID oid,
                             Class cl)
Registers a new implementation for a v3 certificate extension. Called by the classes' static initializers to register those OIDs that the classes implement.

Parameters:
oid - the object id of the extension
class - the class which implements this extension
 o addExtension
 public void addExtension(V3Extension e)
Adds an extension. If an extension with the same object ID already exists, it is replaced.

Parameters:
e - the X509v3 extension to add to the list of extensions
 o removeExtension
 public boolean removeExtension(ObjectID oid)
Removes an extension.

Parameters:
objectID - the object ID of the extension to remove
Returns:
true if the extension was successfully removed false otherwise
 o removeAllExtensions
 public void removeAllExtensions()
Removes all extensions.

 o listExtensions
 public Enumeration listExtensions()
Lists all extensions.

Returns:
an enumeration of the extensions
 o hasExtensions
 public boolean hasExtensions()
Checks, if there are any extensions.

Returns:
true if there are extensions
 o countExtensions
 public int countExtensions()
Returns the number of extensions.

Returns:
the number of extensions
 o getExtension
 public V3Extension getExtension(ObjectID oid)
Returns a specific extension.

Parameters:
objectID - the object ID of the extension
Returns:
the desired extension or null
 o parseExtensions
 protected void parseExtensions(ASN1Object extObj) throws ExtensionException
Initializes the extensions from an ASN1Object. The ASN1Object must be a ASN.1 datastructure "SEQUENCE of Extensions", as can be found in X509v3 certificates or X509v2 CRLs.

Parameters:
extObj - the ASN.1 datastructure "SEQUENCE of Extensions"
Throws: ExtensionException
if there is an error while parsing the extensions
 o createExtensions
 protected ASN1Object createExtensions() throws ExtensionException
Creates an ASN1Object with the extensions. The ASN1Object has the ASN.1 type "SEQUENCE of Extensions". The subclass can add the ASN1Object to the ASN.1 type it implements (X509Certificate, CRL, ...).

Returns:
the extensions as ASN1Object.
Throws: ExtensionException
if the extensions could not be created
 o showExtensions
 protected String showExtensions()
Returns a string that represents the contents of the extensions.

Returns:
the string representation

All Packages  Class Hierarchy  This Package  Previous  Next  Index