public class GenericIdentities extends java.util.AbstractCollection<GenericIdentity> implements TokenIdentityFilter
InternalGenericTokenReader. Its purpose is to read certificates from
an PKCS#11 device, organize them into identities and allow a caller to filter
through the identities to find ones of interest. From an identity, the caller
can access the certificates associated to that identity.
The definition of an Identity is configurable via the use of
TokenIdentityFilter.
The identity of interest is configurable via the use of
GenericIdentityFilter.
Finally, the certificates of interest from an identity are accessible via the
use of GenericCertificateFilter.
| Modifier | Constructor and Description |
|---|---|
protected |
GenericIdentities()
The protected constructor used to initialize the List.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<Identity> |
findAcceptableIdentities(JNIPKCS11 jnip11,
long sessionId,
GenericIdentityFilter identityFilter,
TokenIdentityFilter tokenIdentityFilter)
This method is a starting point for finding all identities on a PKCS#11
device.
|
protected GenericIdentity |
findFirstMatchingIdentity(GenericCertificateAndKeyInfo caki,
TokenIdentityFilter filter)
Finds the first identity to which the given GenericCertificateAndKeyInfo
matches by calling the
TokenIdentityFilter.matchIdentity(Identity, CertificateAndKeyInfo)
method. |
static java.util.List<GenericCertificateAndKeyInfo> |
getCertificateAndKeyInfos(GenericIdentity identity,
GenericCertificateFilter filter)
This is a convenience method to filter an identity for certificates of
interest.
|
java.util.Iterator<GenericIdentity> |
iterator()
Returns an
Iterator that can be used to iterate through all
identities stored in this list. |
boolean |
matchIdentity(Identity identity,
CertificateAndKeyInfo ccaki)
Check if the passed in GenericCertificateAndKeyInfo belongs to the specified
GenericIdentity.
|
int |
size()
Returns the number of identities in this collection.
|
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprotected GenericIdentities()
public boolean matchIdentity(Identity identity, CertificateAndKeyInfo ccaki)
matchIdentity in interface TokenIdentityFilteridentity - The GenericIdentityccaki - The GenericCertificateAndKeyInfopublic java.util.Iterator<GenericIdentity> iterator()
Iterator that can be used to iterate through all
identities stored in this list. The object returned by calling the
next() method of the iterator should be cast to a
GenericIdentity.iterator in interface java.lang.Iterable<GenericIdentity>iterator in interface java.util.Collection<GenericIdentity>iterator in class java.util.AbstractCollection<GenericIdentity>Iterator that can be used to iterate through all
identities stored in this set.public int size()
size in interface java.util.Collection<GenericIdentity>size in class java.util.AbstractCollection<GenericIdentity>protected GenericIdentity findFirstMatchingIdentity(GenericCertificateAndKeyInfo caki, TokenIdentityFilter filter)
TokenIdentityFilter.matchIdentity(Identity, CertificateAndKeyInfo)
method.caki - The GenericCertificateAndKeyInfo which will be used to find
certificates and key that belong to this identity.filter - The TokenIdentityFilter used to find the certificates and keys
that belong to this identity.null if no
matching identity is found.public static java.util.List<Identity> findAcceptableIdentities(JNIPKCS11 jnip11, long sessionId, GenericIdentityFilter identityFilter, TokenIdentityFilter tokenIdentityFilter) throws UserFatalException
jnip11 - sessionId - identityFilter - UserFatalExceptionpublic static java.util.List<GenericCertificateAndKeyInfo> getCertificateAndKeyInfos(GenericIdentity identity, GenericCertificateFilter filter)
GenericCertificateFilter
specifying what criteria they are looking for, the filter is applied to the
identity returning certificates that the filter acceptsidentity - filter -