opencard.opt.security
Class CredentialStore
java.lang.Object
|
+--opencard.opt.security.CredentialStore
- public abstract class CredentialStore
- extends java.lang.Object
A container for cryptographic credentials.
Smartcards may protect access to the data stored on them by means of
cryptography. The card services that are used to access that data will
then require credentials to overcome this protection. The cryptographic
algorithms that have to be used depend on the smartcard's OS. The kind
of credential that has to be presented to the card service depends on
the algorithm to support as well as on the service. For example, if the
algorithm is DES, the credential may be a DES key, or an implementation
of the DES algorithm for a specific key.
As a result of these dependencies, card services supporting a particular
smartcard or smartcard family will define specific credentials that have
to be provided to them. Additionally, they will define a store into which
only these credentials can be put. This class is the abstract base class
of such stores. Methods to put credentials into it as well as to retrieve
them have to be added in dervied classes, since at least the type of the
credentials is service specific.
Applications will collect their credentials for a specific smartcard in
a credential store. Credential stores are collected in instances of class
CredentialBag, so the same application may support different
smartcards without having to worry about which one is inserted.
- See Also:
Credential
,
CredentialBag
,
CardService
Constructor Summary |
protected |
CredentialStore()
Creates a new generic store for credentials. |
Method Summary |
protected Credential |
fetchCredential(java.lang.Object credID)
Retrieves a credential.
|
protected java.util.Enumeration |
getCredentialIDs()
Gets the identifiers of all credentials stored. |
static CredentialStore |
getInstance(java.lang.String className)
Instantiates a new credential store.
|
protected void |
storeCredential(java.lang.Object credID,
Credential cred)
Stores a credential.
|
abstract boolean |
supports(opencard.core.terminal.CardID cardID)
Tests whether this store supports a particular card.
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
CredentialStore
protected CredentialStore()
- Creates a new generic store for credentials.
supports
public abstract boolean supports(opencard.core.terminal.CardID cardID)
- Tests whether this store supports a particular card.
Providers of card services that require credentials have to provide
an appropriate CredentialStore class which supports the
same cards as the services.
- Parameters:
cardID
- the ATR of the smartcard to test for- Returns:
- true if the card is supported,
false otherwise
getInstance
public static CredentialStore getInstance(java.lang.String className)
- Instantiates a new credential store.
The class to instantiate has to provide a default constructor.
- Parameters:
className
- a subclass of CredentialStore to instantiate- Returns:
- a new instance of the argument class,
or null if the instantiation failed
storeCredential
protected final void storeCredential(java.lang.Object credID,
Credential cred)
- Stores a credential.
The credential can be retrieved using fetchCredential with
an identifier equal to the one passed on storing it.
The credentials are stored in a hashtable. The identifier therefore
has to implement hashCode and equals appropriately.
This method is protected since stores supporting a particular card
will require a particular kind of credentials to be stored in them.
They will also define an appropriate identifier for credentials.
- Parameters:
credID
- an identifier for the credentialcred
- the credential to be stored- See Also:
fetchCredential(java.lang.Object)
,
Hashtable
,
Object.hashCode()
,
Object.equals(java.lang.Object)
fetchCredential
protected final Credential fetchCredential(java.lang.Object credID)
- Retrieves a credential.
This method returns the last credential that was passed to
storeCredential with an identifier that equals the
argument.
- Parameters:
credID
- an identifier for the credential to retrieve- Returns:
- the credential for the given identifier,
or null if not found
- See Also:
storeCredential(java.lang.Object, opencard.opt.security.Credential)
getCredentialIDs
protected final java.util.Enumeration getCredentialIDs()
- Gets the identifiers of all credentials stored.
- Returns:
- an enumeration of all identifiers in this store
- See Also:
storeCredential(java.lang.Object, opencard.opt.security.Credential)