CertStore that retrieves Certificates and
CRLs from an LDAP directory, using the PKIX LDAP V2 Schema
(RFC 2587):
http://www.ietf.org/rfc/rfc2587.txt.
Before calling the engineGetCertificates or
engineGetCRLs methods, the
LDAPCertStore(CertStoreParameters) constructor is called to create the
CertStore and establish the DNS name and port of the LDAP
server from which Certificates and CRLs will be
retrieved.
Concurrent Access
As described in the javadoc for CertStoreSpi, the
engineGetCertificates and engineGetCRLs methods
must be thread-safe. That is, multiple threads may concurrently
invoke these methods on a single LDAPCertStore object
(or more than one) with no ill effects. This allows a
CertPathBuilder to search for a CRL while simultaneously
searching for further certificates, for instance.
This is achieved by adding the synchronized keyword to the
engineGetCertificates and engineGetCRLs methods.
This classes uses caching and requests multiple attributes at once to minimize LDAP round trips. The cache is associated with the CertStore instance. It uses soft references to hold the values to minimize impact on footprint and currently has a maximum size of 750 attributes and a 30 second default lifetime.
We always request CA certificates, cross certificate pairs, and ARLs in a single LDAP request when any one of them is needed. The reason is that we typically need all of them anyway and requesting them in one go can reduce the number of requests to a third. Even if we don't need them, these attributes are typically small enough not to cause a noticeable overhead. In addition, when the prefetchCRLs flag is true, we also request the full CRLs. It is currently false initially but set to true once any request for an ARL to the server returns an null value. The reason is that CRLs could be rather large but are rarely used. This implementation should improve performance in most cases.
java.security.cert.CertStore
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Cache | certStoreCache
Returns an LDAPCertStoreImpl object. |
| private static final Debug | |
| private LDAPCertStoreImpl | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized Collection | Returns: aCollection of Certificates that
match the specified selectora selector)CertSelector used to select which
Certificates should be returned.Implements abstract java. Returns a |
| public synchronized Collection | Returns: ACollection of CRLs that
match the specified selectorA selector)CRLSelector used to select which
CRLs should be returned. Specify null
to return all CRLs.Implements abstract java. Returns a |
| pack-priv static synchronized LDAPCertStoreImpl |
| certStoreCache | back to summary |
|---|---|
| private static final Cache<LDAPCertStore. Returns an LDAPCertStoreImpl object. This method consults a cache of LDAPCertStoreImpl objects (shared per JVM) using the corresponding LDAP server name and port info as a key. | |
| debug | back to summary |
|---|---|
| private static final Debug debug | |
| impl | back to summary |
|---|---|
| private LDAPCertStoreImpl impl | |
| ldapDN | back to summary |
|---|---|
| private String ldapDN | |
| LDAPCertStore | back to summary |
|---|---|
| public LDAPCertStore(CertStoreParameters params) throws InvalidAlgorithmParameterException | |
| engineGetCertificates | back to summary |
|---|---|
| public synchronized Collection Implements abstract java. Returns a
It is not practical to search every entry in the LDAP database for
matching
| |
| engineGetCRLs | back to summary |
|---|---|
| public synchronized Collection Implements abstract java. Returns a
It is not practical to search every entry in the LDAP database for
matching
| |
| getInstance | back to summary |
|---|---|
| pack-priv static synchronized LDAPCertStoreImpl getInstance(LDAPCertStoreParameters params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile int | |
| pack-priv int | |
| pack-priv String |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object obj)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public int |
| hashCode | back to summary |
|---|---|
| pack-priv volatile int hashCode | |
| port | back to summary |
|---|---|
| pack-priv int port | |
| serverName | back to summary |
|---|---|
| pack-priv String serverName | |
| Key | back to summary |
|---|---|
| pack-priv Key(String serverName, int port) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |