|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hardtokenmgmt.core.token.BaseToken
public abstract class BaseToken
A Base Token implementation that contains generic operations on token that can be reused by most token implementations
| Field Summary | |
|---|---|
protected int |
MAXNUMOBJECTS
Constant indicating maximum of certificates that can be stored |
protected java.util.HashMap<java.lang.String,iaik.pkcs.pkcs11.Token> |
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 | |
|---|---|
BaseToken()
|
|
| Method Summary | |
|---|---|
void |
addObject(java.lang.String pintype,
java.lang.String pin,
IObject object)
Adds a object (data, domainparameter) to the token |
PINInfo |
blockPIN(java.lang.String pintype)
Method used to block a PIN, used for administrators to later change it |
PINInfo |
changePIN(java.lang.String pintype,
java.lang.String oldpin,
java.lang.String newpin)
Method used to change the value of the |
boolean |
checkPIN(java.lang.String pintype,
java.lang.String pIN)
Method used to check if a PIN is valid and true if it is |
void |
clearCertificateCache()
Method used to clear the internal certificate cache. |
void |
downloadCert(java.lang.String label,
java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
java.security.cert.X509Certificate cert)
Downloads a certificate to the token. |
void |
downloadKeyStore(java.lang.String keytype,
java.lang.String type,
java.lang.String pin,
java.lang.String certLabel,
java.security.KeyStore keyStore,
java.lang.String keyStorePasswd)
Method that downloads a keystores key and certificate on the token. |
void |
genKey(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
java.lang.String keytype,
java.lang.String algorithm,
int keysize,
java.lang.String label)
Method that should generate a key on the card with the specified algorithm. |
org.bouncycastle.jce.PKCS10CertificationRequest |
genPKCS10(java.lang.String keytype,
java.lang.String pintype,
java.lang.String pin,
UserDataGenerator userDataGenerator)
Method that generates a PKCS10 request using the specified key. |
java.security.cert.X509Certificate |
getCertificate(java.lang.String certificateLabel)
Method that tries to find a certificate stored on the token wiht the specified label. |
java.util.Collection |
getCertificates(java.lang.String pintype)
Method that retrieves all certificates stored on the token. |
java.lang.String |
getHardTokenSN()
Method that should return the current hard token serial number of the card. |
java.util.Collection |
getKeyLabels(java.lang.String pintype)
Method to get all labels of the keys (private) on the card. |
java.util.Collection |
getObjects(java.lang.String pintype,
java.lang.String pin,
java.lang.String objectType)
Returns all objects of type (data or domain parameters) stored on the card |
PINInfo |
getPINInfo(java.lang.String pintype)
Method that returns the current PIN related info about the given PIB |
protected abstract 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 abstract java.lang.String |
getPrivateKeyLabel(java.lang.String keytype)
Method that should find the right key label given the keytype. |
long |
getSlotId(java.lang.String pintype)
Method returning the slotId that is associated with this token. |
void |
init(boolean useVirtualSlots,
iaik.pkcs.pkcs11.Token token)
Method that should be called by the TokenManager only when creating an instance. |
protected abstract boolean |
isInitialized(iaik.pkcs.pkcs11.Token token)
Method that should return true if the token is currently initialized. |
protected void |
reInitToken()
Method used to reinitialize the token. |
protected void |
removeAllKeys(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin)
Removes all keys for a keytype. |
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 |
void |
removeObject(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
IObject object)
Method that removes a Data or Domain Parameters object from the card |
PINInfo |
unblockPIN(java.lang.String pintype,
java.lang.String puk,
java.lang.String newpin)
Method used to enter the PUK code to unblock a PIN code after to many erronious tries. |
PINInfo |
unlockPIN(java.lang.String pintype,
java.lang.String pin)
Method used to login to a PIN in order to be able to perform operations on the card, this is not the same as unblock PIN |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hardtokenmgmt.core.token.IToken |
|---|
clearToken, generatePUK, getSupportedPINTypes, initToken, isTokenSupported, requirePUKInDB |
| Field Detail |
|---|
protected int MAXNUMOBJECTS
protected java.util.HashMap<java.lang.String,iaik.pkcs.pkcs11.Token> tokens
| Constructor Detail |
|---|
public BaseToken()
| Method Detail |
|---|
public java.lang.String getHardTokenSN()
throws iaik.pkcs.pkcs11.TokenException
IToken
getHardTokenSN in interface ITokeniaik.pkcs.pkcs11.TokenExceptionIToken.getHardTokenSN()
public void init(boolean useVirtualSlots,
iaik.pkcs.pkcs11.Token token)
throws iaik.pkcs.pkcs11.TokenException
IToken
init in interface ITokeniaik.pkcs.pkcs11.TokenExceptionIToken.init(boolean, Token)
protected abstract boolean isInitialized(iaik.pkcs.pkcs11.Token token)
throws iaik.pkcs.pkcs11.TokenException
iaik.pkcs.pkcs11.TokenException
protected abstract java.lang.String getPINLabel(iaik.pkcs.pkcs11.Token token,
java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype -
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenException
protected abstract java.lang.String getPrivateKeyLabel(java.lang.String keytype)
throws OperationNotSupportedException
keytype - the keytype to find
OperationNotSupportedException
public void genKey(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
java.lang.String keytype,
java.lang.String algorithm,
int keysize,
java.lang.String label)
throws ObjectAlreadyExistsException,
OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
genKey in interface ITokenpintype - one of the PINTYPE_ indicating the PIN that should protect the keypin - 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 keyskeytype - one of the KEYTYPE_ constants or the label of the object for custom keysalgorithm - one of the KEYALG_ constantskeysize - the size of the keylabel - a reference to the key to use.
ObjectAlreadyExistsException - if the keytype already exists.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.genKey(String, String, String, String, String, int, String)
public org.bouncycastle.jce.PKCS10CertificationRequest genPKCS10(java.lang.String keytype,
java.lang.String pintype,
java.lang.String pin,
UserDataGenerator userDataGenerator)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
genPKCS10 in interface ITokenkeytype - which key that should be used for the request.pintype - of the PIN needed to unlock the tokenpin - the pin to unlock (May not be required, then can null be used)userDataGenerator - user data generator to use when fetching token labels.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.genPKCS10(String, String, String, UserDataGenerator)
public void downloadCert(java.lang.String label,
java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
java.security.cert.X509Certificate cert)
throws ObjectAlreadyExistsException,
OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
downloadCert in interface ITokenlabel - the label used to mark the object on the token.pintype - of the PIN needed to unlock the tokenpin - the pin to unlock (May not be required, then can null be used)basicpin - to unlock the certificate store.
ObjectAlreadyExistsException - if a certificate with the label already exists.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.downloadCert(String, String, String, String, X509Certificate)
public void downloadKeyStore(java.lang.String keytype,
java.lang.String type,
java.lang.String pin,
java.lang.String certLabel,
java.security.KeyStore keyStore,
java.lang.String keyStorePasswd)
throws ObjectAlreadyExistsException,
OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
downloadKeyStore in interface ITokenkeytype - one of the KEYTYPE_ constants or the label of the object for custom keystype - of the PIN needed to unlock the tokenpin - the pin to unlock (May not be required, then can null be used)certLabel - label the label used to mark the object on the token.keyStore - the java keystore to extract the keystore fromkeyStorePasswd - the passwordused to lock the keystore
ObjectAlreadyExistsException - if a certificate or key with the label already exists.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.downloadKeyStore(String, String, String, String, KeyStore, String)
public java.util.Collection getCertificates(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getCertificates in interface ITokenpintype - of the PIN that are connected to the certificates
OperationNotSupportedException - if this operation isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.getCertificates(String)
public java.security.cert.X509Certificate getCertificate(java.lang.String certificateLabel)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getCertificate in interface ITokencertificateLabel - of the certficate to look for
OperationNotSupportedException - if this operation isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.getCertificate(String)
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
IToken
removeCertificate in interface ITokenpintype - of the PIN needed to unlock the tokenpin - 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
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.removeCertificate(String, String, String, X509Certificate)
public void addObject(java.lang.String pintype,
java.lang.String pin,
IObject object)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
addObject in interface ITokenpintype - of the PIN that should protect the key, null for no protectionpin - the pin to unlock the private area (May not be required, then can null be used)object - a object to add to the token
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.addObject(String pintype, String pin, IObject object)
public java.util.Collection getObjects(java.lang.String pintype,
java.lang.String pin,
java.lang.String objectType)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getObjects in interface ITokenpintype - of the PIN needed to unlock the token, if neccessarypin - the pin to unlock (May not be required, then can null be used)objectType - of object to return, one of the OBJECTTYPE_ constants
OperationNotSupportedException - if this operation isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.getObjects(String, String, String)
public void removeObject(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
IObject object)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
removeObject in interface ITokenpintype - of the PIN needed to unlock the tokenpin - the pin to unlock (May not be required, then can null be used)basicpin - to unlock (May not be required, then can null be used)object - the iaik.pkcs.pkcs11.objects.Object object to remove
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.removeObject(String, String, String, IObject)
public PINInfo getPINInfo(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getPINInfo in interface ITokenpintype - one of the PINTYPE_ constants
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.getPINInfo(String)
public PINInfo changePIN(java.lang.String pintype,
java.lang.String oldpin,
java.lang.String newpin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
changePIN in interface ITokenpintype - one of the PINTYPE_ constantsoldpin - the old pinvaluenewpin - the new pinvalue
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenExceptionIToken.changePIN(String, String, String)
public PINInfo unlockPIN(java.lang.String pintype,
java.lang.String pin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
unlockPIN in interface ITokenpintype - one of the PINTYPE_ constantspin - the pin that should be used for login
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.unlockPIN(String, String)
public PINInfo unblockPIN(java.lang.String pintype,
java.lang.String puk,
java.lang.String newpin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
unblockPIN in interface ITokenpintype - one of the PINTYPE_ constantspuk - the PUK that should be used to unblocknewpin - the new PIN.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.unblockPIN(String, String, String)
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
IToken
removeKey in interface ITokenpintype - of the PIN needed to unlock the tokenpin - 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 certificateslabel - of the key
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.removeKey(String, String, String, String)
protected void removeAllKeys(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenException
public java.util.Collection getKeyLabels(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getKeyLabels in interface ITokenpintype - of the PIN needed to unlock the key
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.getKeyLabels(String)
protected void reInitToken()
throws iaik.pkcs.pkcs11.TokenException
iaik.pkcs.pkcs11.TokenException
public PINInfo blockPIN(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
blockPIN in interface ITokenpintype - one of the PINTYPE_ constants
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.blockPIN(String)public void clearCertificateCache()
clearCertificateCache in interface IToken
public boolean checkPIN(java.lang.String pintype,
java.lang.String pIN)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
checkPIN in interface ITokenOperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.checkPIN(String, String)
public long getSlotId(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
IToken
getSlotId in interface ITokenOperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.IToken.checkPIN(String, String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||