|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IToken
Class acting as interface to different tokens supported The main implementing class is BaseToken that all other tokens should extend. For key types should the defined constants be used. It is possible to custom types, then will the type value be used as label. Not all implementation support all keytypes
| Field Summary | |
|---|---|
static java.lang.String |
KEYALG_RSA
Constant indicating that a RSA key should be generated |
static java.lang.String |
KEYTYPE_ALL
Constants to all keys on a token, should only be used with the getCertificates method |
static java.lang.String |
KEYTYPE_AUTH
Constant that refers the basic auth key on the token. |
static java.lang.String |
KEYTYPE_ENC
Constant that refers the encryption key on the token. |
static java.lang.String |
KEYTYPE_SIGN
Constant that refers the signing key on the token. |
static java.lang.String |
OBJECTTYPE_DATA
Constant indicating that data objects should be processed |
static java.lang.String |
PINTYPE_BASIC
Constant that refers to the basic PIN that usually protects the AUTH and ENC key All type of IToken implementations might not support all types. |
static java.lang.String |
PINTYPE_SIGN
Constant that refers to the basic PIN that usually protects the AUTH and ENC key All type of IToken implementations might not support all types. |
| 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 instructing the token to clear it's certificate cache if it have any. |
void |
clearToken(java.lang.String[] pintypes,
java.lang.String[] puks)
Method that should clear a token, either erase the card completely or remove all objects on the card for non-ereasable tokens. |
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 pintype,
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. |
java.lang.String |
generatePUK(java.lang.String pintype)
Method that should generate the PUK code placed on the card for the specified PIN. |
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 certficateLabel)
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 |
long |
getSlotId(java.lang.String pintype)
Method returning the slotId that is associated with this token. |
java.lang.String[] |
getSupportedPINTypes()
Method that should return the tokens supported PIN types Either PINTYPE_ constants or customdefined labels |
void |
init(boolean useVirtualSlots,
iaik.pkcs.pkcs11.Token token)
Method that should be called by the TokenManager only when creating an instance. |
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)
Method used for knowing if an implementation supports the current token in process. |
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 |
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 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 |
| Field Detail |
|---|
static final java.lang.String KEYTYPE_ALL
static final java.lang.String KEYTYPE_AUTH
static final java.lang.String KEYTYPE_SIGN
static final java.lang.String KEYTYPE_ENC
static final java.lang.String PINTYPE_BASIC
static final java.lang.String PINTYPE_SIGN
static final java.lang.String KEYALG_RSA
static final java.lang.String OBJECTTYPE_DATA
| Method Detail |
|---|
java.lang.String getHardTokenSN()
throws iaik.pkcs.pkcs11.TokenException
iaik.pkcs.pkcs11.TokenException
void init(boolean useVirtualSlots,
iaik.pkcs.pkcs11.Token token)
throws iaik.pkcs.pkcs11.TokenException
iaik.pkcs.pkcs11.TokenException
boolean isTokenSupported(iaik.pkcs.pkcs11.Token token)
throws iaik.pkcs.pkcs11.TokenException
token - the current token inserted into the slot.
iaik.pkcs.pkcs11.TokenException - if a pkcs11 related problem occursjava.lang.String[] getSupportedPINTypes()
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
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 PUKpins - 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
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
void clearToken(java.lang.String[] pintypes,
java.lang.String[] puks)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
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 stringspuks - optional parameter used by some cards with non-erasable filesystem and
needs the PUK code to erease some areas.
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
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
pintype - 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.
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
keytype - 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.
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
label - 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.
void downloadKeyStore(java.lang.String keytype,
java.lang.String pintype,
java.lang.String pin,
java.lang.String certLabel,
java.security.KeyStore keyStore,
java.lang.String keyStorePasswd)
throws ObjectAlreadyExistsException,
OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
keytype - one of the KEYTYPE_ constants or the label of the object for custom keyspintype - 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.
java.util.Collection getCertificates(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
java.security.cert.X509Certificate getCertificate(java.lang.String certficateLabel)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
certficateLabel - of the certficate to look for
OperationNotSupportedException - if this operation isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
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
pintype - 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 certificatescert -
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
java.util.Collection getKeyLabels(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
void removeKey(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicpin,
java.lang.String label)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
void addObject(java.lang.String pintype,
java.lang.String pin,
IObject object)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
java.util.Collection getObjects(java.lang.String pintype,
java.lang.String pin,
java.lang.String objectType)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
void removeObject(java.lang.String pintype,
java.lang.String pin,
java.lang.String basicPIN,
IObject object)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
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 (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.
PINInfo getPINInfo(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
PINInfo changePIN(java.lang.String pintype,
java.lang.String oldpin,
java.lang.String newpin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - one of the PINTYPE_ constantsoldpin - the old pinvaluenewpin - the new pinvalue
OperationNotSupportedException
iaik.pkcs.pkcs11.TokenException
PINInfo unlockPIN(java.lang.String pintype,
java.lang.String pin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
PINInfo unblockPIN(java.lang.String pintype,
java.lang.String puk,
java.lang.String newpin)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.
PINInfo blockPIN(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
pintype - 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.void clearCertificateCache()
boolean checkPIN(java.lang.String pintype,
java.lang.String pIN)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
boolean requirePUKInDB()
throws iaik.pkcs.pkcs11.TokenException
iaik.pkcs.pkcs11.TokenException - for other token related failures.
java.lang.String generatePUK(java.lang.String pintype)
throws OperationNotSupportedException
OperationNotSupportedException - if this method isn't supported by this token.
long getSlotId(java.lang.String pintype)
throws OperationNotSupportedException,
iaik.pkcs.pkcs11.TokenException
OperationNotSupportedException - if this operation or some of it's parameters isn't supported
iaik.pkcs.pkcs11.TokenException - for other token related failures.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||