java.lang.Object | ||
↳ | java.security.cert.CertStoreSpi | |
↳ | sun.security.provider.certpath.LDAPCertStore |
A CertStore
that retrieves Certificates
and
CRL
s 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 Certificate
s and CRL
s 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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a
CertStore with the specified parameters. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a
Collection of CRL s that
match the specified selector. | |||||||||||
Returns a
Collection of Certificate s that
match the specified selector. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates a CertStore
with the specified parameters.
For this class, the parameters object must be an instance of
LDAPCertStoreParameters
.
params | the algorithm parameters |
---|
InvalidAlgorithmParameterException | if params is not an
instance of LDAPCertStoreParameters
|
---|
Returns a Collection
of CRL
s that
match the specified selector. If no CRL
s
match the selector, an empty Collection
will be returned.
It is not practical to search every entry in the LDAP database for
matching CRL
s. Instead, the CRLSelector
is examined in order to determine where matching CRL
s
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.
selector | A CRLSelector used to select which
CRL s should be returned. Specify null
to return all CRL s. |
---|
Collection
of CRL
s that
match the specified selectorCertStoreException | if an exception occurs |
---|
Returns a Collection
of Certificate
s that
match the specified selector. If no Certificate
s
match the selector, an empty Collection
will be returned.
It is not practical to search every entry in the LDAP database for
matching Certificate
s. Instead, the CertSelector
is examined in order to determine where matching Certificate
s
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.
selector | a CertSelector used to select which
Certificate s should be returned. |
---|
Collection
of Certificate
s that
match the specified selectorCertStoreException | if an exception occurs |
---|