org.hardtokenmgmt.core.token
Class SetCos441InstantEIDToken

java.lang.Object
  extended by org.hardtokenmgmt.core.token.BaseToken
      extended by org.hardtokenmgmt.core.token.SetCos441InstantEIDToken
All Implemented Interfaces:
IToken
Direct Known Subclasses:
NetIdPrimeEIDLogonOnlyToken, NetIdSetCos441Token

public class SetCos441InstantEIDToken
extends BaseToken

Implementation specific token class for Setec 32K SetCos 441 Instant eID cards

Version:
$Id$
Author:
Philip Vendil 2006-aug-30

Field Summary
 
Fields inherited from class org.hardtokenmgmt.core.token.BaseToken
MAXNUMOBJECTS, tokens
 
Fields inherited from interface org.hardtokenmgmt.core.token.IToken
KEYALG_RSA, KEYTYPE_ALL, KEYTYPE_AUTH, KEYTYPE_ENC, KEYTYPE_SIGN, OBJECTTYPE_DATA, PINTYPE_BASIC, PINTYPE_SIGN
 
Constructor Summary
SetCos441InstantEIDToken()
           
 
Method Summary
 void clearToken(java.lang.String[] pintypes, java.lang.String[] puks)
          Method to clear the content of a SetCos 441 card
 java.lang.String generatePUK(java.lang.String pintype)
          Method that should generate the PUK code placed on the card for the specified PIN.
protected  java.lang.String getPINLabel(iaik.pkcs.pkcs11.Token token, java.lang.String pintype)
          Method that should return the label of the tokens virtual slot that is associated with the given pintype.
protected  java.lang.String getPrivateKeyLabel(java.lang.String keytype)
          Method that should find the right key label given the keytype.
 java.lang.String[] getSupportedPINTypes()
          Method that should return the tokens supported PIN types Either PINTYPE_ constants or customdefined labels
 void initToken(java.lang.String tokenlabel, java.lang.String tokenserial, java.lang.String[] pintypes, java.lang.String[] pins, java.lang.String[] puks)
          Method that should initialize a token, cards that non-ereasable should clean the card as much as possible.
protected  boolean isInitialized(iaik.pkcs.pkcs11.Token token)
          Method that should return true if the token is currently initialized.
 boolean isTokenSupported(iaik.pkcs.pkcs11.Token token)
          Method used for knowing if an implementation supports the current token in process.
 boolean requirePUKInDB()
          Method determining if the token requires the PUK to be uploaded to DB prior to initialization This is mainly for tokens that cannot be reformatted.
 
Methods inherited from class org.hardtokenmgmt.core.token.BaseToken
addObject, blockPIN, changePIN, checkPIN, clearCertificateCache, downloadCert, downloadKeyStore, genKey, genPKCS10, getCertificate, getCertificates, getHardTokenSN, getKeyLabels, getObjects, getPINInfo, getSlotId, init, reInitToken, removeAllKeys, removeCertificate, removeKey, removeObject, unblockPIN, unlockPIN
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetCos441InstantEIDToken

public SetCos441InstantEIDToken()
Method Detail

isTokenSupported

public boolean isTokenSupported(iaik.pkcs.pkcs11.Token token)
                         throws iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method used for knowing if an implementation supports the current token in process.

Parameters:
token - the current token inserted into the slot.
Returns:
true if the current IToken implementation supports this token.
Throws:
iaik.pkcs.pkcs11.TokenException - if a pkcs11 related problem occurs

getSupportedPINTypes

public java.lang.String[] getSupportedPINTypes()
Description copied from interface: IToken
Method that should return the tokens supported PIN types Either PINTYPE_ constants or customdefined labels


initToken

public void initToken(java.lang.String tokenlabel,
                      java.lang.String tokenserial,
                      java.lang.String[] pintypes,
                      java.lang.String[] pins,
                      java.lang.String[] puks)
               throws OperationNotSupportedException,
                      iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method that should initialize a token, cards that non-ereasable should clean the card as much as possible. Keys protected by each PIN may be generated but isn't required

Parameters:
tokenlabel - the label of the token, can be null if no token label should be set.
tokenserial - the serial number that should be written to the card, only used if the card supports the serial number to be set during initialization otherwise could null be used.
pintypes - an array of PINTYPE_contants or custom label strings. Indicates which key that should have which PIN and PUK
pins - an array of pin codes used in the initialization, should be used with the keytype array get hold of key to use. be defined in the getKeyIndex type.
puks - an array of puk codes for each PIN
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.

clearToken

public void clearToken(java.lang.String[] pintypes,
                       java.lang.String[] puks)
                throws OperationNotSupportedException,
                       iaik.pkcs.pkcs11.TokenException
Method to clear the content of a SetCos 441 card

Parameters:
pintypes - optional parameter used by some cards with non-erasable filesystem and needs the PUK code to erease some areas. Should contain an array of PINTYPE_contants or custom label strings
puks - optional parameter used by some cards with non-erasable filesystem and needs the PUK code to erease some areas.
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.

getPrivateKeyLabel

protected java.lang.String getPrivateKeyLabel(java.lang.String keytype)
                                       throws OperationNotSupportedException
Description copied from class: BaseToken
Method that should find the right key label given the keytype.

Specified by:
getPrivateKeyLabel in class BaseToken
Parameters:
keytype - the keytype to find
Throws:
OperationNotSupportedException

getPINLabel

protected java.lang.String getPINLabel(iaik.pkcs.pkcs11.Token token,
                                       java.lang.String pintype)
                                throws OperationNotSupportedException,
                                       iaik.pkcs.pkcs11.TokenException
Description copied from class: BaseToken
Method that should return the label of the tokens virtual slot that is associated with the given pintype.

Specified by:
getPINLabel in class BaseToken
Returns:
The label of the token in the slot
Throws:
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenException

requirePUKInDB

public boolean requirePUKInDB()
                       throws iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method determining if the token requires the PUK to be uploaded to DB prior to initialization This is mainly for tokens that cannot be reformatted.

Returns:
'true' if PUK data must exist in database before card is managed. 'false' othervise.
Throws:
iaik.pkcs.pkcs11.TokenException
See Also:
IToken.requirePUKInDB()

generatePUK

public java.lang.String generatePUK(java.lang.String pintype)
                             throws OperationNotSupportedException
Description copied from interface: IToken
Method that should generate the PUK code placed on the card for the specified PIN. Should only be used in the case requirePUKInDB is false and PUK codes should be generated during token initialization. This is mainly for tokens that cannot be reformatted.

Returns:
a valid PUK supported by the token
Throws:
OperationNotSupportedException - if this method isn't supported by this token.
See Also:
IToken.generatePUK(String)

isInitialized

protected boolean isInitialized(iaik.pkcs.pkcs11.Token token)
                         throws iaik.pkcs.pkcs11.TokenException
Description copied from class: BaseToken
Method that should return true if the token is currently initialized.

Specified by:
isInitialized in class BaseToken
Returns:
method that should return true if the token is currently initialized.
Throws:
iaik.pkcs.pkcs11.TokenException