Class CertificateValidity
java.lang.Object
org.mozilla.jss.netscape.security.x509.CertificateValidity
- All Implemented Interfaces:
Serializable,CertAttrSet
This class defines the interval for which the certificate is valid.
- Version:
- 1.12
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIdentifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.static final StringSub attributes name for this CertAttrSet.static final Stringstatic final Stringprivate Dateprivate Dateprivate static final longprivate static final long -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for the class.CertificateValidity(Date notBefore, Date notAfter) The default constructor for this class for the specified interval.Create the object, decoding the values from the passed DER stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoiddecode(InputStream in) Decode the CertificateValidity period from the InputStream.voidDelete the attribute value.voidencode(OutputStream out) Encode the CertificateValidity period in DER form to the stream.Get the attribute value.Return an enumeration of names of attributes existing within this attribute.getName()Return the name of this attribute.private Dateprivate Dateprivate voidreadObject(ObjectInputStream stream) voidSet the attribute value.toString()Return the validity period as user readable string.voidvalid()Verify that the current time is within the validity period.voidVerify that the passed time is within the validity period.private voidwriteObject(ObjectOutputStream stream)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
IDENT
Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.- See Also:
-
NAME
Sub attributes name for this CertAttrSet.- See Also:
-
NOT_BEFORE
- See Also:
-
NOT_AFTER
- See Also:
-
YR_2050
private static final long YR_2050- See Also:
-
notBefore
-
notAfter
-
-
Constructor Details
-
CertificateValidity
public CertificateValidity()Default constructor for the class. -
CertificateValidity
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.
-
CertificateValidity
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.
-
-
Method Details
-
getNotBefore
-
getNotAfter
-
construct
- Throws:
IOException
-
toString
Return the validity period as user readable string.- Specified by:
toStringin interfaceCertAttrSet- Overrides:
toStringin classObject- Returns:
- value of this certificate attribute in printable form.
-
decode
Decode the CertificateValidity period from the InputStream.- Specified by:
decodein interfaceCertAttrSet- Parameters:
in- the InputStream to unmarshal the contents from.- Throws:
IOException- on errors.
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
-
encode
Encode the CertificateValidity period in DER form to the stream.- Specified by:
encodein interfaceCertAttrSet- Parameters:
out- the OutputStream to marshal the contents to.- Throws:
IOException- on errors.
-
set
Set the attribute value.- Specified by:
setin interfaceCertAttrSet- Parameters:
name- the name of the attribute (e.g. "x509.info.key")obj- the attribute object.- Throws:
IOException- on other errors.
-
get
Get the attribute value.- Specified by:
getin interfaceCertAttrSet- Parameters:
name- the name of the attribute to return.- Returns:
- attribute value
- Throws:
IOException- on other errors.
-
delete
Delete the attribute value.- Specified by:
deletein interfaceCertAttrSet- Parameters:
name- the name of the attribute to delete.- Throws:
IOException- on other errors.
-
getAttributeNames
Return an enumeration of names of attributes existing within this attribute.- Specified by:
getAttributeNamesin interfaceCertAttrSet- Returns:
- an enumeration of the attribute names.
-
getName
Return the name of this attribute.- Specified by:
getNamein interfaceCertAttrSet- Returns:
- the name of this CertAttrSet.
-
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.
-
valid
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 theDatesupplied.CertificateNotYetValidException- if the certificate is not yet valid with respect to theDatesupplied.
-