spki
Class Validity

java.lang.Object
  |
  +--spki.BaseObj
        |
        +--spki.Validity
Direct Known Subclasses:
ValidTransfer

public class Validity
extends BaseObj

SPKI Validity class.

Formal definitions:

 <valid-basic>:: <not-before>? <maybe-after>? <not-after>? ;
 <recency>:: <off-line> | <on-line> ;
 <valid>:: "(" "valid" <valid-basic>? <recency>? ")" ;
 
where an empty validity, i.e. "(valid)", means "always valid".

Version:
$Id: Validity.java,v 1.11 2002/05/15 23:05:08 tep Exp $
Author:
Tep Narula <tep@win.trlabs.ca>
See Also:
ValidOffline, ValidOnline, ValidTransfer

Field Summary
private static String __ME
          This class's full name.
private  boolean always_valid
          Is this an always-valid object?
private  Date maybe_after
          The maybe-after date value.
static String MAYBEAFTER_SEXP_NAME
          The maybe-after S-Expression type name, used by toSExpression() and other methods.
private  Date not_after
          The not-after date value.
private  Date not_before
          The not-before date value.
static String NOTAFTER_SEXP_NAME
          The not-after S-Expression type name, used by toSExpression() and other methods.
static String NOTBEFORE_SEXP_NAME
          The not-before S-Expression type name, used by toSExpression() and other methods.
private  ValidOffline offline
          The offline validity condition object.
private  ValidOnline online
          The online validity condition object.
static String SEXP_NAME
          This class S-Expression type name, used by toSExpression() and other methods.
 
Fields inherited from class spki.BaseObj
__ME, cache_sexp, cached_sexp, DEFAULT_HASH_ALG, locked, SEXP_NAME
 
Constructor Summary
Validity()
          Create an always-valid Validity object.
Validity(Date not_before, Date maybe_after, Date not_after, ValidOffline offline, ValidOnline online)
          Create an immutable Validity object from given not-before date, and/or maybe-after date, and/or not-after date, and/or offline validity condition or online validity condition.
Validity(SExpression sexp)
          Create an immutable Validity object from an S-Expression.
 
Method Summary
 Date getMaybeAfter()
          Get the maybe-after field, if available.
 Date getNotAfter()
          Get the not-after field, if available.
 Date getNotBefore()
          Get the not-before field, if available.
 ValidOffline getValidOffline()
          Get the valid-offline field, if available.
 ValidOnline getValidOnline()
          Get the valid-online field, if available.
 boolean isAlwaysValid()
          Is this an always-valid object?
 SExpression toSExpression()
          Build an SExpression representing this object.
private  boolean verifyDates()
          Verify the relation among the not_before, maybe_after, and not_after date values.
 
Methods inherited from class spki.BaseObj
disableSExpressionCaching, enableSExpressionCaching, extractHashAlgId, getCachedSExpression, isLocked, isSListOfType, lock, providerToSPKI, setCachedSExpression, spkiToProvider, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

__ME

private static final String __ME
This class's full name.

SEXP_NAME

public static final String SEXP_NAME
This class S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

NOTBEFORE_SEXP_NAME

public static final String NOTBEFORE_SEXP_NAME
The not-before S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

not_before

private Date not_before
The not-before date value.

MAYBEAFTER_SEXP_NAME

public static final String MAYBEAFTER_SEXP_NAME
The maybe-after S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

maybe_after

private Date maybe_after
The maybe-after date value.

NOTAFTER_SEXP_NAME

public static final String NOTAFTER_SEXP_NAME
The not-after S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

not_after

private Date not_after
The not-after date value.

offline

private ValidOffline offline
The offline validity condition object.

online

private ValidOnline online
The online validity condition object.

always_valid

private boolean always_valid
Is this an always-valid object?
Constructor Detail

Validity

public Validity()
Create an always-valid Validity object.
See Also:
Validity(SExpression), Validity(Date,Date,Date,ValidOffline,ValidOnline)

Validity

public Validity(SExpression sexp)
         throws ParseException,
                SPKIException
Create an immutable Validity object from an S-Expression.
See Also:
BaseObj.BaseObj(SExpression)

Validity

public Validity(Date not_before,
                Date maybe_after,
                Date not_after,
                ValidOffline offline,
                ValidOnline online)
         throws SPKIException
Create an immutable Validity object from given not-before date, and/or maybe-after date, and/or not-after date, and/or offline validity condition or online validity condition. The offline validity condition and the online validity condition are mutually exclusive, i.e. if the offline argument is not null then the online argument will be ignored.
Parameters:
not_before - the not-before date, maybe null.
maybe_after - the maybe-after date, maybe null.
not_after - the not-after date, maybe null.
offline - the offline validity condition, maybe null.
online - the online validity condition, maybe null.
Throws:
SPKIException - if something went wrong.
See Also:
Validity()
Method Detail

toSExpression

public SExpression toSExpression()
                          throws SPKIException
Description copied from interface: SPKIObject
Build an SExpression representing this object.
Overrides:
toSExpression in class BaseObj
Tags copied from interface: SPKIObject
Returns:
SExpression object representing this object, or null.
Throws:
SPKIException - if something went wrong during conversion.

getNotBefore

public Date getNotBefore()
Get the not-before field, if available.
Returns:
a Date object, or null.

getMaybeAfter

public Date getMaybeAfter()
Get the maybe-after field, if available.
Returns:
a Date object, or null.

getNotAfter

public Date getNotAfter()
Get the not-after field, if available.
Returns:
a Date object, or null.

getValidOffline

public ValidOffline getValidOffline()
Get the valid-offline field, if available.
Returns:
a ValidOffline object, or null.

getValidOnline

public ValidOnline getValidOnline()
Get the valid-online field, if available.
Returns:
a ValidOnline object, or null.

isAlwaysValid

public boolean isAlwaysValid()
Is this an always-valid object?
Returns:
true if this is always valid, false otherwise.

verifyDates

private boolean verifyDates()
Verify the relation among the not_before, maybe_after, and not_after date values. The correct relation is: not_before < maybe_after < not_after.
Returns:
true if the relation holds, false otherwise.