com.ibm.security12.sun.security.x509
Class CertificateExtensions

java.lang.Object
  |
  +--com.ibm.security12.sun.security.x509.CertificateExtensions

public class CertificateExtensions
extends Object
implements CertAttrSet

This class defines the Extensions attribute for the Certificate.

Version:
1.17
Author:
Amit Kapoor, Hemma Prafullchandra
See Also:
CertAttrSet

Field Summary
static String IDENT
          Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.
static String NAME
          name
 
Constructor Summary
CertificateExtensions()
          Default constructor.
CertificateExtensions(DerInputStream in)
          Create the object, decoding the values from the passed DER stream.
 
Method Summary
 void decode(InputStream in)
          Decode the extensions from the InputStream.
 void delete(String name)
          Delete the attribute value.
 void encode(OutputStream out)
          Encode the extensions in DER form to the stream, setting the context specific tag as needed in the X.509 v3 certificate.
 void encode(OutputStream out, boolean isCertReq)
          Encode the extensions in DER form to the stream.
 boolean equals(Object other)
          Compares this CertificateExtensions for equality with the specified object.
 Object get(String name)
          Get the attribute value.
 Collection getAllExtensions()
          Return a collection view of the extensions.
 Enumeration getElements()
          Return an enumeration of names of attributes existing within this attribute.
 String getName()
          Return the name of this attribute.
 int hashCode()
          Returns a hashcode value for this CertificateExtensions.
 boolean hasUnsupportedCriticalExtension()
          Return true if a critical extension is found that is not supported, otherwise return false.
 void set(String name, Object obj)
          Set the attribute value.
 String toString()
          Returns a string representation of this CertificateExtensions object in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IDENT

public static final String IDENT
Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.

NAME

public static final String NAME
name
Constructor Detail

CertificateExtensions

public CertificateExtensions()
Default constructor.

CertificateExtensions

public CertificateExtensions(DerInputStream in)
                      throws IOException
Create the object, decoding the values from the passed DER stream.
Parameters:
in - the DerInputStream to read the Extension from.
Throws:
IOException - on decoding errors.
Method Detail

decode

public void decode(InputStream in)
            throws IOException
Decode the extensions from the InputStream.
Specified by:
decode in interface CertAttrSet
Parameters:
in - the InputStream to unmarshal the contents from.
Throws:
IOException - on decoding or validity errors.

encode

public void encode(OutputStream out)
            throws CertificateException,
                   IOException
Encode the extensions in DER form to the stream, setting the context specific tag as needed in the X.509 v3 certificate.
Specified by:
encode in interface CertAttrSet
Parameters:
out - the DerOutputStream to marshal the contents to.
Throws:
CertificateException - on encoding errors.
IOException - on errors.

encode

public void encode(OutputStream out,
                   boolean isCertReq)
            throws CertificateException,
                   IOException
Encode the extensions in DER form to the stream.
Parameters:
out - the DerOutputStream to marshal the contents to.
isCertReq - if true then no context specific tag is added.
Throws:
CertificateException - on encoding errors.
IOException - on errors.

set

public void set(String name,
                Object obj)
         throws IOException
Set the attribute value.
Specified by:
set in interface CertAttrSet
Parameters:
name - the extension name used in the cache.
obj - the object to set.
Throws:
IOException - if the object could not be cached.

get

public Object get(String name)
           throws IOException
Get the attribute value.
Specified by:
get in interface CertAttrSet
Parameters:
name - the extension name used in the lookup.
Throws:
IOException - if named extension is not found.

delete

public void delete(String name)
            throws IOException
Delete the attribute value.
Specified by:
delete in interface CertAttrSet
Parameters:
name - the extension name used in the lookup.
Throws:
IOException - if named extension is not found.

getElements

public Enumeration getElements()
Return an enumeration of names of attributes existing within this attribute.
Specified by:
getElements in interface CertAttrSet

getAllExtensions

public Collection getAllExtensions()
Return a collection view of the extensions.
Returns:
a collection view of the extensions in this Certificate.

getName

public String getName()
Return the name of this attribute.
Specified by:
getName in interface CertAttrSet

hasUnsupportedCriticalExtension

public boolean hasUnsupportedCriticalExtension()
Return true if a critical extension is found that is not supported, otherwise return false.

equals

public boolean equals(Object other)
Compares this CertificateExtensions for equality with the specified object. If the other object is an instanceof CertificateExtensions, then all the entries are compared with the entries from this.
Parameters:
other - the object to test for equality with this CertificateExtensions.
Returns:
true iff all the entries match that of the Other, false otherwise.
Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hashcode value for this CertificateExtensions.
Returns:
the hashcode value.
Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of this CertificateExtensions object in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space).

Overrides to toString method of Object.

Specified by:
toString in interface CertAttrSet
Returns:
a string representation of this CertificateExtensions.
Overrides:
toString in class Object