opencard.opt.security
Class CredentialBag
java.lang.Object
|
+--opencard.opt.security.CredentialBag
- public class CredentialBag
- extends java.lang.Object
A container for stores that hold cryptographic credentials.
Smartcards may protect access to the data stored on them by means of
cryptography. Applications have to provide cryptographic credentials
to the card services they are using, so the services can overcome this
protection. The credentials for a particular smartcard are collected
in instances of class CredentialStore. These stores are
collected in instances of this class.
An application that supports different smartcards will set up a store
for each of the cards. Then, it puts all these stores into a bag. This
bag is passed to the card service that is used to access a particular
smartcard that has been inserted. The card service will pick the right
store from the bag and use the credentials in that store. That way, the
application does not have to worry about which particular card it is
currently working with.
- See Also:
Credential
,
CredentialStore
,
CardService
Field Summary |
protected java.util.Vector |
credentialBag
The container to hold the CredentialStore objects. |
Constructor Summary |
CredentialBag()
Instantiates an empty credential bag. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
credentialBag
protected java.util.Vector credentialBag
- The container to hold the CredentialStore objects.
CredentialBag
public CredentialBag()
- Instantiates an empty credential bag.
addCredentialStore
public void addCredentialStore(CredentialStore credstore)
- Adds a store to this bag.
- Parameters:
credstore
- The CredentialStore object to be added.
getCredentialStore
public final CredentialStore getCredentialStore(opencard.core.terminal.CardID cardID,
java.lang.Class clazz)
- Retrieves a single store from this bag.
This method searches for a store that supports a particular
smartcard and is an instance of a given class or interface.
One matching store is returned. To get all matching stores,
use getCredentialStores.
- Parameters:
cardID
- the identifier of the smartcard to supportclazz
- the type of the store to return.
Use CredentialStore.class if the
type does not matter.- Returns:
- a store matching the criteria,
or null if none is found
- See Also:
getCredentialStores(opencard.core.terminal.CardID, java.lang.Class)
getCredentialStores
public final CredentialStore[] getCredentialStores(opencard.core.terminal.CardID cardID,
java.lang.Class clazz)
- Retrieves stores from this bag.
This method searches for all stores that support a particular smartcard
and are instances of a given class or interface.
The selection by card is necessary since an application may provide
different keys for different smartcards it resides on. The additional
selection by the type (or class) of the store is also necessary, since
a card service that searches for an appropriate store will require
particular access methods not defined in the base class.
- Parameters:
cardID
- the identifier of the smartcard to supportclazz
- the type of the store to return.
Use CredentialStore.class if the
type does not matter.- Returns:
- an array holding all matching stores,
or null if none is found.
The array element type is the class passed as argument, so the
whole array can be down-casted instead of each element.