public class

CertificateValidity

extends Object
implements CertAttrSet<T>
java.lang.Object
   ↳ sun.security.x509.CertificateValidity

Class Overview

This class defines the interval for which the certificate is valid.

See Also

Summary

Constants
String IDENT Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.
String NAME Sub attributes name for this CertAttrSet.
String NOT_AFTER
String NOT_BEFORE
Public Constructors
CertificateValidity()
Default constructor for the class.
CertificateValidity(Date notBefore, Date notAfter)
The default constructor for this class for the specified interval.
CertificateValidity(DerInputStream in)
Create the object, decoding the values from the passed DER stream.
Public Methods
void delete(String name)
Delete the attribute value.
void encode(OutputStream out)
Encode the CertificateValidity period in DER form to the stream.
Object get(String name)
Get the attribute value.
Enumeration<String> 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 validity period as user readable string.
void valid()
Verify that the current time is within the validity period.
void valid(Date now)
Verify that the passed time is within the validity period.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.security.x509.CertAttrSet

Constants

public static final String IDENT

Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.

Constant Value: "x509.info.validity"

public static final String NAME

Sub attributes name for this CertAttrSet.

Constant Value: "validity"

public static final String NOT_AFTER

Constant Value: "notAfter"

public static final String NOT_BEFORE

Constant Value: "notBefore"

Public Constructors

public CertificateValidity ()

Default constructor for the class.

public CertificateValidity (Date notBefore, Date notAfter)

The default constructor for this class for the specified interval.

Parameters
notBefore the date and time before which the certificate is not valid.
notAfter the date and time after which the certificate is not valid.

public CertificateValidity (DerInputStream in)

Create the object, decoding the values from the passed DER stream.

Parameters
in the DerInputStream to read the CertificateValidity from.
Throws
IOException on decoding errors.

Public Methods

public void delete (String name)

Delete the attribute value.

Parameters
name the name of the attribute to delete.
Throws
IOException

public void encode (OutputStream out)

Encode the CertificateValidity period in DER form to the stream.

Parameters
out the OutputStream to marshal the contents to.
Throws
IOException on errors.

public Object get (String name)

Get the attribute value.

Parameters
name the name of the attribute to return.
Throws
IOException

public Enumeration<String> getElements ()

Return an enumeration of names of attributes existing within this attribute.

Returns
  • an enumeration of the attribute names.

public String getName ()

Return the name of this attribute.

Returns
  • the name of this CertAttrSet.

public void set (String name, Object obj)

Set the attribute value.

Parameters
name the name of the attribute (e.g. "x509.info.key")
obj the attribute object.
Throws
IOException

public String toString ()

Return the validity period as user readable string.

Returns
  • a string representation of the object.

public void valid ()

Verify that the current time is within the validity period.

Throws
CertificateExpiredException if the certificate has expired.
CertificateNotYetValidException if the certificate is not yet valid.

public void valid (Date now)

Verify that the passed time is within the validity period.

Parameters
now the Date against which to compare the validity period.
Throws
CertificateExpiredException if the certificate has expired with respect to the Date supplied.
CertificateNotYetValidException if the certificate is not yet valid with respect to the Date supplied.