public class CertificateValidity extends java.lang.Object implements CertAttrSet, java.io.Serializable
CertAttrSet
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
IDENT
Identifier for this attribute, to be used with the
get, set, delete methods of Certificate, x509 type.
|
static java.lang.String |
NAME
Sub attributes name for this CertAttrSet.
|
static java.lang.String |
NOT_AFTER |
static java.lang.String |
NOT_BEFORE |
Constructor and Description |
---|
CertificateValidity()
Default constructor for the class.
|
CertificateValidity(java.util.Date notBefore,
java.util.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.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(java.io.InputStream in)
Decode the CertificateValidity period from the InputStream.
|
void |
delete(java.lang.String name)
Delete the attribute value.
|
void |
encode(java.io.OutputStream out)
Encode the CertificateValidity period in DER form to the stream.
|
java.lang.Object |
get(java.lang.String name)
Get the attribute value.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Return an enumeration of names of attributes existing within this
attribute.
|
java.lang.String |
getName()
Return the name of this attribute.
|
void |
set(java.lang.String name,
java.lang.Object obj)
Set the attribute value.
|
java.lang.String |
toString()
Return the validity period as user readable string.
|
void |
valid()
Verify that the current time is within the validity period.
|
void |
valid(java.util.Date now)
Verify that the passed time is within the validity period.
|
public static final java.lang.String IDENT
public static final java.lang.String NAME
public static final java.lang.String NOT_BEFORE
public static final java.lang.String NOT_AFTER
public CertificateValidity()
public CertificateValidity(java.util.Date notBefore, java.util.Date notAfter)
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) throws java.io.IOException
in
- the DerInputStream to read the CertificateValidity from.java.io.IOException
- on decoding errors.public java.lang.String toString()
toString
in interface CertAttrSet
toString
in class java.lang.Object
public void decode(java.io.InputStream in) throws java.io.IOException
decode
in interface CertAttrSet
in
- the InputStream to unmarshal the contents from.java.io.IOException
- on errors.public void encode(java.io.OutputStream out) throws java.io.IOException
encode
in interface CertAttrSet
out
- the OutputStream to marshal the contents to.java.io.IOException
- on errors.public void set(java.lang.String name, java.lang.Object obj) throws java.io.IOException
set
in interface CertAttrSet
name
- the name of the attribute (e.g. "x509.info.key")obj
- the attribute object.java.io.IOException
- on other errors.public java.lang.Object get(java.lang.String name) throws java.io.IOException
get
in interface CertAttrSet
name
- the name of the attribute to return.java.io.IOException
- on other errors.public void delete(java.lang.String name) throws java.io.IOException
delete
in interface CertAttrSet
name
- the name of the attribute to delete.java.io.IOException
- on other errors.public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface CertAttrSet
public java.lang.String getName()
getName
in interface CertAttrSet
public void valid() throws java.security.cert.CertificateNotYetValidException, java.security.cert.CertificateExpiredException
java.security.cert.CertificateExpiredException
- if the certificate has expired.java.security.cert.CertificateNotYetValidException
- if the certificate is not
yet valid.public void valid(java.util.Date now) throws java.security.cert.CertificateNotYetValidException, java.security.cert.CertificateExpiredException
now
- the Date against which to compare the validity
period.java.security.cert.CertificateExpiredException
- if the certificate has expired
with respect to the Date
supplied.java.security.cert.CertificateNotYetValidException
- if the certificate is not
yet valid with respect to the Date
supplied.