org.hardtokenmgmt.core.token
Class NetIdPrimeEIDLogonOnlyToken

java.lang.Object
  extended by org.hardtokenmgmt.core.token.BaseToken
      extended by org.hardtokenmgmt.core.token.SetCos441InstantEIDToken
          extended by org.hardtokenmgmt.core.token.NetIdPrimeEIDLogonOnlyToken
All Implemented Interfaces:
IToken

public class NetIdPrimeEIDLogonOnlyToken
extends SetCos441InstantEIDToken

Implementation specific token class for PrimeCard (Siemens CardOS 4.3) cards with manly logon support.

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
NetIdPrimeEIDLogonOnlyToken()
           
 
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 generating one and the same PUK for all PIN types.
 java.util.Collection getCertificates(java.lang.String pintype)
          Method that retrieves all certificates stored on the token.
 PINInfo getPINInfo(java.lang.String pintype)
          Special method for NetId where a dummy trial login is done before the PIN status is checked.
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.
 boolean isTokenSupported(iaik.pkcs.pkcs11.Token token)
          Labels indicating that the token cannot be reinitialized and should be cleaned instead.
 void removeCertificate(java.lang.String pintype, java.lang.String pin, java.lang.String basicpin, java.security.cert.X509Certificate cert)
          Method removing the specified certificate from the token.
 void removeKey(java.lang.String pintype, java.lang.String pin, java.lang.String basicpin, java.lang.String label)
          Method removing a specified key from a card
 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.
 PINInfo unblockPIN(java.lang.String pintype, java.lang.String puk, java.lang.String newpin)
          Method that overloads the standard version and uses native calls instead.
 
Methods inherited from class org.hardtokenmgmt.core.token.SetCos441InstantEIDToken
isInitialized
 
Methods inherited from class org.hardtokenmgmt.core.token.BaseToken
addObject, blockPIN, changePIN, checkPIN, clearCertificateCache, downloadCert, downloadKeyStore, genKey, genPKCS10, getCertificate, getHardTokenSN, getKeyLabels, getObjects, getSlotId, init, reInitToken, removeAllKeys, removeObject, unlockPIN
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetIdPrimeEIDLogonOnlyToken

public NetIdPrimeEIDLogonOnlyToken()
Method Detail

isTokenSupported

public boolean isTokenSupported(iaik.pkcs.pkcs11.Token token)
                         throws iaik.pkcs.pkcs11.TokenException
Labels indicating that the token cannot be reinitialized and should be cleaned instead.

Specified by:
isTokenSupported in interface IToken
Overrides:
isTokenSupported in class SetCos441InstantEIDToken
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

Specified by:
getSupportedPINTypes in interface IToken
Overrides:
getSupportedPINTypes in class SetCos441InstantEIDToken

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

Specified by:
initToken in interface IToken
Overrides:
initToken in class SetCos441InstantEIDToken
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.

unblockPIN

public PINInfo unblockPIN(java.lang.String pintype,
                          java.lang.String puk,
                          java.lang.String newpin)
                   throws OperationNotSupportedException,
                          iaik.pkcs.pkcs11.TokenException
Method that overloads the standard version and uses native calls instead.

Specified by:
unblockPIN in interface IToken
Overrides:
unblockPIN in class BaseToken
Parameters:
pintype - one of the PINTYPE_ constants
puk - the PUK that should be used to unblock
newpin - the new PIN.
Returns:
a PINInfo object indicating the new status of the PIN
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
IToken.unblockPIN(String, String, String)

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

Specified by:
clearToken in interface IToken
Overrides:
clearToken in class SetCos441InstantEIDToken
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.

Overrides:
getPrivateKeyLabel in class SetCos441InstantEIDToken
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.

Overrides:
getPINLabel in class SetCos441InstantEIDToken
Returns:
The label of the token in the slot
Throws:
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenException

generatePUK

public java.lang.String generatePUK(java.lang.String pintype)
                             throws OperationNotSupportedException
Method generating one and the same PUK for all PIN types.

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

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.

Specified by:
requirePUKInDB in interface IToken
Overrides:
requirePUKInDB in class SetCos441InstantEIDToken
Returns:
'true' if PUK data must exist in database before card is managed. 'false' othervise.
Throws:
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
IToken.requirePUKInDB()

getPINInfo

public PINInfo getPINInfo(java.lang.String pintype)
                   throws OperationNotSupportedException,
                          iaik.pkcs.pkcs11.TokenException
Special method for NetId where a dummy trial login is done before the PIN status is checked. This since most card OS doesn't support retrieving PIN status without trying to login first.

Specified by:
getPINInfo in interface IToken
Overrides:
getPINInfo in class BaseToken
Parameters:
pintype - one of the PINTYPE_ constants
Returns:
a PINInfo object
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
BaseToken.getPINInfo(java.lang.String)

removeCertificate

public void removeCertificate(java.lang.String pintype,
                              java.lang.String pin,
                              java.lang.String basicpin,
                              java.security.cert.X509Certificate cert)
                       throws OperationNotSupportedException,
                              iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method removing the specified certificate from the token.

Specified by:
removeCertificate in interface IToken
Overrides:
removeCertificate in class BaseToken
Parameters:
pintype - of the PIN needed to unlock the token
pin - the pin to unlock (May not be required, then can null be used)
basicpin - pin to unlock the basic area, might be used for signature certificates
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
IToken.removeCertificate(String, String, String, X509Certificate)

removeKey

public void removeKey(java.lang.String pintype,
                      java.lang.String pin,
                      java.lang.String basicpin,
                      java.lang.String label)
               throws OperationNotSupportedException,
                      iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method removing a specified key from a card

Specified by:
removeKey in interface IToken
Overrides:
removeKey in class BaseToken
Parameters:
pintype - of the PIN needed to unlock the token
pin - the pin to unlock (May not be required, then can null be used)
basicpin - pin to unlock the basic area, might be used for signature certificates
label - of the key
Throws:
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
IToken.removeKey(String, String, String, String)

getCertificates

public java.util.Collection getCertificates(java.lang.String pintype)
                                     throws OperationNotSupportedException,
                                            iaik.pkcs.pkcs11.TokenException
Description copied from interface: IToken
Method that retrieves all certificates stored on the token.

Specified by:
getCertificates in interface IToken
Overrides:
getCertificates in class BaseToken
Parameters:
pintype - of the PIN that are connected to the certificates
Returns:
a Collection of X509Certificate
Throws:
OperationNotSupportedException - if this operation isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
See Also:
IToken.getCertificates(String)