Package java.security.cert
Class CertStore
- java.lang.Object
-
- java.security.cert.CertStore
-
public class CertStore extends Object
This class provides the functionality to retrieveCertificates andCRLs from a read-only repository. This repository may be very large and may store trusted as well as untrusted certificates.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params)Creates a newCertStoreinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<? extends Certificate>getCertificates(CertSelector selector)Returns the list ofCertificates for the specifiedCertSelectorfrom this certificate store.CertStoreParametersgetCertStoreParameters()Returns a copy of the certificate store parameters that were used to initialize this instance.Collection<? extends CRL>getCRLs(CRLSelector selector)Returns the list ofCRLs for the specifiedCRLSelectorfrom this certificate store.static StringgetDefaultType()Returns the defaultCertStoretype from the Security Properties.static CertStoregetInstance(String type, CertStoreParameters params)Creates a newCertStoreinstance with the specified type and initialized with the specified parameters.static CertStoregetInstance(String type, CertStoreParameters params, String provider)Creates a newCertStoreinstance from the specified provider with the specified type and initialized with the specified parameters.static CertStoregetInstance(String type, CertStoreParameters params, Provider provider)Creates a newCertStoreinstance from the specified provider with the specified type and initialized with the specified parameters.ProvidergetProvider()Returns the security provider.StringgetType()Returns the certificate store type.
-
-
-
Constructor Detail
-
CertStore
protected CertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params)
Creates a newCertStoreinstance.- Parameters:
storeSpi- the implementation delegate.provider- the security provider.type- the certificate store type.params- the certificate store parameters (may benull.
-
-
Method Detail
-
getInstance
public static CertStore getInstance(String type, CertStoreParameters params) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
Creates a newCertStoreinstance with the specified type and initialized with the specified parameters.- Parameters:
type- the certificate store type.params- the certificate store parameters (may benull).- Returns:
- the new certificate store instance.
- Throws:
NoSuchAlgorithmException- if no provider can provide the specified certificate store type.InvalidAlgorithmParameterException- if the specified parameters cannot be used to initialize this certificate store instance.NullPointerException- iftype == null
-
getInstance
public static CertStore getInstance(String type, CertStoreParameters params, String provider) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException
Creates a newCertStoreinstance from the specified provider with the specified type and initialized with the specified parameters.- Parameters:
type- the certificate store type.params- the certificate store parameters (may benull).provider- the name of the provider.- Returns:
- the new certificate store instance.
- Throws:
NoSuchAlgorithmException- if the specified provider cannot provide the requested certificate store type.NoSuchProviderException- if no provider with the specified name can be found.InvalidAlgorithmParameterException- if the specified parameters cannot be used to initialize this certificate store instance.IllegalArgumentException- ifprovider == null || provider.isEmpty()NullPointerException- iftypeisnull.
-
getInstance
public static CertStore getInstance(String type, CertStoreParameters params, Provider provider) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
Creates a newCertStoreinstance from the specified provider with the specified type and initialized with the specified parameters. Theprovidersupplied does not have to be registered.- Parameters:
type- the certificate store type.params- the certificate store parameters (may benull).provider- the name of the provider.- Returns:
- the new certificate store instance.
- Throws:
NoSuchAlgorithmException- if the specified provider cannot provide the requested certificate store type.InvalidAlgorithmParameterException- if the specified parameters cannot be used to initialize this certificate store instance.IllegalArgumentException- ifprovider == nullNullPointerException- iftype == null
-
getType
public final String getType()
Returns the certificate store type.- Returns:
- the certificate store type.
-
getProvider
public final Provider getProvider()
Returns the security provider.- Returns:
- the security provider.
-
getCertStoreParameters
public final CertStoreParameters getCertStoreParameters()
Returns a copy of the certificate store parameters that were used to initialize this instance.- Returns:
- a copy of the certificate store parameters or
nullif none were specified.
-
getCertificates
public final Collection<? extends Certificate> getCertificates(CertSelector selector) throws CertStoreException
Returns the list ofCertificates for the specifiedCertSelectorfrom this certificate store.- Parameters:
selector- the selector containing the criteria to search for certificates in this certificate store.- Returns:
- the list of
Certificates that match the criteria of the specified selector. - Throws:
CertStoreException- if error(s) occur.
-
getCRLs
public final Collection<? extends CRL> getCRLs(CRLSelector selector) throws CertStoreException
Returns the list ofCRLs for the specifiedCRLSelectorfrom this certificate store.- Parameters:
selector- the selector containing the criteria to search for certificate revocation lists in this store.- Returns:
- the list of
CRLs that match the criteria of the specified selector - Throws:
CertStoreException- if error(s) occur.
-
getDefaultType
public static final String getDefaultType()
Returns the defaultCertStoretype from the Security Properties.- Returns:
- the default
CertStoretype from the Security Properties, or the string"LDAP"if it cannot be determined.
-
-