org.hardtokenmgmt.core.util
Class DetermineCardStatus

java.lang.Object
  extended by org.hardtokenmgmt.core.util.DetermineCardStatus

public class DetermineCardStatus
extends java.lang.Object

Class used to determine the status of the card and from that determine the menu choices

Version:
$Id$
Author:
Philip Vendil 2006 sep 27

Field Summary
static int CARD_EMPTY
          The card seems to be empty
static int CARD_EXPIRING
          One of the certificates is about to expire
static int CARD_LOCKED
          The card have at least one PIN locked.
static int CARD_NOLOGONCERTIFICATE
          if no certificate suitable for logon could be found on an admin token.
static int CARD_NOPROCESSABLECARD
          If no processable card is inserted in the reader.
static int CARD_NOTVALID
          if the tokens logon certificate have expired or not yet valid
static int CARD_ONHOLD
          Status returned if the processable card is on hold and should be reactivated
static int CARD_PERSONALIZED_WITH_OTHERSYSTEM
          if the token have been personalized but with another system.
static int CARD_PERSONLIZED
          The card seems already personlized, this is determed by the existens of certificates on the token.
static int CARD_REVOKED
          if the token have been revoked
static int CARD_TOMANYPROCESSABLECARDS
          If more that more processable card is inserted. this status is returned to inform the administrator to remove one of them.
static int CARD_UNKNOWN
          The status of the card couldn't be determined
static int NO_PUK_DATA_UPLOADED
          if the token requires PUK data to be uploaded to database prior to manage it, but no data haven't been uploaded yet.
 
Constructor Summary
DetermineCardStatus()
           
 
Method Summary
static int getAdminCardStatus(boolean checkRevocation)
          Method used to check the status of the administration card.
static int getCardStatus()
          Method that analysis the card a determines which page that should be shown to the end user.
static boolean isCardEmpty(IToken token)
          Method determining if a card is empty. i.e doesn't have any certificates
static boolean isCardLocked(IToken processableToken, boolean onlyBasicPIN)
          Method used to determine if a card is locked or not, onlyBasicPIN flag indicates that inly the basic PIN should be checked.
static boolean isCertExpiring(java.security.cert.X509Certificate cert)
          Method used to check if a certificate is about to expire Within the thresholds configured in global.properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CARD_UNKNOWN

public static final int CARD_UNKNOWN
The status of the card couldn't be determined

See Also:
Constant Field Values

CARD_NOPROCESSABLECARD

public static final int CARD_NOPROCESSABLECARD
If no processable card is inserted in the reader.

See Also:
Constant Field Values

CARD_TOMANYPROCESSABLECARDS

public static final int CARD_TOMANYPROCESSABLECARDS
If more that more processable card is inserted. this status is returned to inform the administrator to remove one of them.

See Also:
Constant Field Values

CARD_EMPTY

public static final int CARD_EMPTY
The card seems to be empty

See Also:
Constant Field Values

CARD_PERSONLIZED

public static final int CARD_PERSONLIZED
The card seems already personlized, this is determed by the existens of certificates on the token.

See Also:
Constant Field Values

CARD_LOCKED

public static final int CARD_LOCKED
The card have at least one PIN locked.

See Also:
Constant Field Values

CARD_EXPIRING

public static final int CARD_EXPIRING
One of the certificates is about to expire

See Also:
Constant Field Values

CARD_REVOKED

public static final int CARD_REVOKED
if the token have been revoked

See Also:
Constant Field Values

CARD_PERSONALIZED_WITH_OTHERSYSTEM

public static final int CARD_PERSONALIZED_WITH_OTHERSYSTEM
if the token have been personalized but with another system.

See Also:
Constant Field Values

NO_PUK_DATA_UPLOADED

public static final int NO_PUK_DATA_UPLOADED
if the token requires PUK data to be uploaded to database prior to manage it, but no data haven't been uploaded yet.

See Also:
Constant Field Values

CARD_NOTVALID

public static final int CARD_NOTVALID
if the tokens logon certificate have expired or not yet valid

See Also:
Constant Field Values

CARD_NOLOGONCERTIFICATE

public static final int CARD_NOLOGONCERTIFICATE
if no certificate suitable for logon could be found on an admin token.

See Also:
Constant Field Values

CARD_ONHOLD

public static final int CARD_ONHOLD
Status returned if the processable card is on hold and should be reactivated

See Also:
Constant Field Values
Constructor Detail

DetermineCardStatus

public DetermineCardStatus()
Method Detail

getCardStatus

public static int getCardStatus()
Method that analysis the card a determines which page that should be shown to the end user.

Returns:
one of the CARD constants.

getAdminCardStatus

public static int getAdminCardStatus(boolean checkRevocation)
Method used to check the status of the administration card. It performs lighter checks of the cards, not revokation or it's hard token data.

Returns:
one of the CARD constants.

isCardLocked

public static boolean isCardLocked(IToken processableToken,
                                   boolean onlyBasicPIN)
                            throws OperationNotSupportedException,
                                   iaik.pkcs.pkcs11.TokenException
Method used to determine if a card is locked or not, onlyBasicPIN flag indicates that inly the basic PIN should be checked.

Throws:
iaik.pkcs.pkcs11.TokenException
OperationNotSupportedException

isCertExpiring

public static boolean isCertExpiring(java.security.cert.X509Certificate cert)
Method used to check if a certificate is about to expire Within the thresholds configured in global.properties

Parameters:
cert - to check
Returns:
true if the certificate is about to expire.

isCardEmpty

public static boolean isCardEmpty(IToken token)
                           throws OperationNotSupportedException,
                                  iaik.pkcs.pkcs11.TokenException
Method determining if a card is empty. i.e doesn't have any certificates

Parameters:
token - the token to check
Returns:
true if the card is empty
Throws:
iaik.pkcs.pkcs11.TokenException
OperationNotSupportedException