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

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

public class CertificateVersion
extends Object
implements CertAttrSet

This class defines the version of the X509 Certificate.

Version:
1.9
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
          Sub attributes name for this CertAttrSet.
static int V1
          X509Certificate Version 1
static int V2
          X509Certificate Version 2
static int V3
          X509Certificate Version 3
static String VERSION
           
 
Constructor Summary
CertificateVersion()
          The default constructor for this class, sets the version to 0 (i.e.
CertificateVersion(DerInputStream in)
          Create the object, decoding the values from the passed DER stream.
CertificateVersion(DerValue val)
          Create the object, decoding the values from the passed DerValue.
CertificateVersion(InputStream in)
          Create the object, decoding the values from the passed stream.
CertificateVersion(int version)
          The constructor for this class for the required version.
 
Method Summary
 int compare(int vers)
          Compare versions.
 void decode(InputStream in)
          Decode the CertificateVersion period in DER form from the stream.
 void delete(String name)
          Delete the attribute value.
 void encode(OutputStream out)
          Encode the CertificateVersion period in DER form to the stream.
 Object get(String name)
          Get the attribute value.
 Enumeration getElements()
          Return an enumeration of names of attributes existing within this attribute.
 String getName()
          Return the name of this attribute.
 void set(String name, Object obj)
          Set the attribute value.
 String toString()
          Return the version number of the certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

V1

public static final int V1
X509Certificate Version 1

V2

public static final int V2
X509Certificate Version 2

V3

public static final int V3
X509Certificate Version 3

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
Sub attributes name for this CertAttrSet.

VERSION

public static final String VERSION
Constructor Detail

CertificateVersion

public CertificateVersion()
The default constructor for this class, sets the version to 0 (i.e. X.509 version 1).

CertificateVersion

public CertificateVersion(int version)
                   throws IOException
The constructor for this class for the required version.
Parameters:
version - the version for the certificate.
Throws:
IOException - if the version is not valid.

CertificateVersion

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

CertificateVersion

public CertificateVersion(InputStream in)
                   throws IOException
Create the object, decoding the values from the passed stream.
Parameters:
in - the InputStream to read the CertificateVersion from.
Throws:
IOException - on decoding errors.

CertificateVersion

public CertificateVersion(DerValue val)
                   throws IOException
Create the object, decoding the values from the passed DerValue.
Parameters:
val - the Der encoded value.
Throws:
IOException - on decoding errors.
Method Detail

toString

public String toString()
Return the version number of the certificate.
Specified by:
toString in interface CertAttrSet
Overrides:
toString in class Object

encode

public void encode(OutputStream out)
            throws IOException
Encode the CertificateVersion period in DER form to the stream.
Specified by:
encode in interface CertAttrSet
Parameters:
out - the OutputStream to marshal the contents to.
Throws:
IOException - on errors.

decode

public void decode(InputStream in)
            throws IOException
Decode the CertificateVersion period in DER form from the stream.
Specified by:
decode in interface CertAttrSet
Parameters:
in - the InputStream to unmarshal the contents from.
Throws:
IOException - on errors.

set

public void set(String name,
                Object obj)
         throws IOException
Set the attribute value.
Specified by:
set in interface CertAttrSet

get

public Object get(String name)
           throws IOException
Get the attribute value.
Specified by:
get in interface CertAttrSet

delete

public void delete(String name)
            throws IOException
Delete the attribute value.
Specified by:
delete in interface CertAttrSet

getElements

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

getName

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

compare

public int compare(int vers)
Compare versions.