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:
- a static part: is responsible for registering implementations
of extensions
- a dynamic part: manages the extensions (for its subclass)
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
-
X509Extensions()
- Default Constructor.
-
addExtension(V3Extension)
- Adds an extension.
-
countExtensions()
- Returns the number of extensions.
-
create(ObjectID)
- Returns the implementation of the specified extension defined through an ASN.1 ObjectID.
-
createExtensions()
- Creates an ASN1Object with the extensions.
-
getExtension(ObjectID)
- Returns a specific extension.
-
hasExtensions()
- Checks, if there are any extensions.
-
listExtensions()
- Lists all extensions.
-
parseExtensions(ASN1Object)
- Initializes the extensions from an ASN1Object.
-
register(ObjectID, Class)
- Registers a new implementation for a v3 certificate extension.
-
removeAllExtensions()
- Removes all extensions.
-
removeExtension(ObjectID)
- Removes an extension.
-
showExtensions()
- Returns a string that represents the contents of the extensions.
X509Extensions
public X509Extensions()
- Default Constructor.
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
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
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
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
removeAllExtensions
public void removeAllExtensions()
- Removes all extensions.
listExtensions
public Enumeration listExtensions()
- Lists all extensions.
- Returns:
- an enumeration of the extensions
hasExtensions
public boolean hasExtensions()
- Checks, if there are any extensions.
- Returns:
- true if there are extensions
countExtensions
public int countExtensions()
- Returns the number of extensions.
- Returns:
- the number of extensions
getExtension
public V3Extension getExtension(ObjectID oid)
- Returns a specific extension.
- Parameters:
- objectID - the object ID of the extension
- Returns:
- the desired extension or null
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
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
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