public class

LDAPCertStore

extends CertStoreSpi
java.lang.Object
   ↳ java.security.cert.CertStoreSpi
     ↳ sun.security.provider.certpath.LDAPCertStore

Class Overview

A 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.

See Also

Summary

Public Constructors
LDAPCertStore(CertStoreParameters params)
Creates a CertStore with the specified parameters.
Public Methods
synchronized Collection<X509CRL> engineGetCRLs(CRLSelector selector)
Returns a Collection of CRLs that match the specified selector.
synchronized Collection<X509Certificate> engineGetCertificates(CertSelector selector)
Returns a Collection of Certificates that match the specified selector.
[Expand]
Inherited Methods
From class java.security.cert.CertStoreSpi
From class java.lang.Object

Public Constructors

public LDAPCertStore (CertStoreParameters params)

Creates a CertStore with the specified parameters. For this class, the parameters object must be an instance of LDAPCertStoreParameters.

Parameters
params the algorithm parameters
Throws
InvalidAlgorithmParameterException if params is not an instance of LDAPCertStoreParameters

Public Methods

public synchronized Collection<X509CRL> engineGetCRLs (CRLSelector selector)

Returns a Collection of CRLs that match the specified selector. If no CRLs match the selector, an empty Collection will be returned.

It is not practical to search every entry in the LDAP database for matching CRLs. Instead, the CRLSelector is examined in order to determine where matching CRLs are likely to be found (according to the PKIX LDAPv2 schema, RFC 2587). If issuerNames or certChecking are specified, the issuer's directory entry is searched. If neither issuerNames or certChecking are specified (or the selector is not an X509CRLSelector), a CertStoreException is thrown.

Parameters
selector A CRLSelector used to select which CRLs should be returned. Specify null to return all CRLs.
Returns
  • A Collection of CRLs that match the specified selector
Throws
CertStoreException if an exception occurs

public synchronized Collection<X509Certificate> engineGetCertificates (CertSelector selector)

Returns a Collection of Certificates that match the specified selector. If no Certificates match the selector, an empty Collection will be returned.

It is not practical to search every entry in the LDAP database for matching Certificates. Instead, the CertSelector is examined in order to determine where matching Certificates are likely to be found (according to the PKIX LDAPv2 schema, RFC 2587). If the subject is specified, its directory entry is searched. If the issuer is specified, its directory entry is searched. If neither the subject nor the issuer are specified (or the selector is not an X509CertSelector), a CertStoreException is thrown.

Parameters
selector a CertSelector used to select which Certificates should be returned.
Returns
  • a Collection of Certificates that match the specified selector
Throws
CertStoreException if an exception occurs