APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class CertificateValidity

extends Object
implements DerEncoder
Class Inheritance
All Implemented Interfaces
sun.security.util.DerEncoder
Imports
java.io.IOException, java.security.cert.*, java.util.Date, .Objects, sun.security.util.*

This class defines the interval for which the certificate is valid.
Authors
Amit Kapoor, Hemma Prafullchandra
See Also
DerEncoder

Field Summary

Modifier and TypeField and Description
public static final String
private final Date
private final Date
pack-priv static final long
YR_2050

YR_2050 date and time set to Jan01 00:00 2050 GMT

Constructor Summary

AccessConstructor and Description
public
CertificateValidity(Date
the date and time before which the certificate is not valid
notBefore
,
Date
the date and time after which the certificate is not valid
notAfter
)

The constructor for this class for the specified interval.

public
CertificateValidity(DerInputStream
the DerInputStream to read the CertificateValidity from
in
)

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

Method Summary

Modifier and TypeMethod and Description
public void
encode(DerOutputStream
the DerOutputStream to marshal the contents to.
out
)

Implements sun.security.util.DerEncoder.encode.

Encode the CertificateValidity period in DER form to the stream.

public Date
public Date
public String
toString()

Overrides java.lang.Object.toString.

Return the validity period as user readable string.

public void
valid()

Verify that the current time is within the validity period.

public void
valid(Date
the Date against which to compare the validity period.
now
)

Verify that the passed time is within the validity period.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

NAMEback to summary
public static final String NAME
notAfterback to summary
private final Date notAfter
notBeforeback to summary
private final Date notBefore
YR_2050back to summary
pack-priv static final long YR_2050

YR_2050 date and time set to Jan01 00:00 2050 GMT

Constructor Detail

CertificateValidityback to summary
public CertificateValidity(Date notBefore, Date notAfter)

The constructor for this class for the specified interval.

Parameters
notBefore:Date

the date and time before which the certificate is not valid

notAfter:Date

the date and time after which the certificate is not valid

CertificateValidityback to summary
public CertificateValidity(DerInputStream in) throws IOException

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

Parameters
in:DerInputStream

the DerInputStream to read the CertificateValidity from

Exceptions
IOException:
on decoding errors.

Method Detail

encodeback to summary
public void encode(DerOutputStream out)

Implements sun.security.util.DerEncoder.encode.

Encode the CertificateValidity period in DER form to the stream.

Parameters
out:DerOutputStream

the DerOutputStream to marshal the contents to.

Annotations
@Override
getNotAfterback to summary
public Date getNotAfter()
getNotBeforeback to summary
public Date getNotBefore()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Return the validity period as user readable string.

validback to summary
public void valid() throws CertificateNotYetValidException, CertificateExpiredException

Verify that the current time is within the validity period.

Exceptions
CertificateNotYetValidException:
if the certificate is not yet valid.
CertificateExpiredException:
if the certificate has expired.
validback to summary
public void valid(Date now) throws CertificateNotYetValidException, CertificateExpiredException

Verify that the passed time is within the validity period.

Parameters
now:Date

the Date against which to compare the validity period.

Exceptions
CertificateNotYetValidException:
if the certificate is not yet valid with respect to the Date supplied.
CertificateExpiredException:
if the certificate has expired with respect to the Date supplied.