Package 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.- Author:
- Reto Hermann (rhe@zurich.ibm.com), Roland Weber (rolweber@de.ibm.com)
- See Also:
Credential
,CredentialStore
,CardService
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Vector
credentialBag
The container to hold the CredentialStore objects.
-
Constructor Summary
Constructors Constructor Description CredentialBag()
Instantiates an empty credential bag.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCredentialStore(CredentialStore credstore)
Adds a store to this bag.CredentialStore
getCredentialStore(CardID cardID, java.lang.Class clazz)
Retrieves a single store from this bag.CredentialStore[]
getCredentialStores(CardID cardID, java.lang.Class clazz)
Retrieves stores from this bag.
-
-
-
Method Detail
-
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(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(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.
-
-