FileDocCategorySizeDatePackage
CertStore.javaAPI DocAndroid 1.5 API11275Wed May 06 22:41:06 BST 2009java.security.cert

CertStore

public class CertStore extends Object
This class provides the functionality to retrieve {@code Certificate}s and {@code CRL}s from a read-only repository. This repository may be very large and may store trusted as well as untrusted certificates.
since
Android 1.0

Fields Summary
private static final String
SERVICE
private static org.apache.harmony.security.fortress.Engine
engine
private static final String
PROPERTYNAME
private static final String
DEFAULTPROPERTY
private final Provider
provider
private final CertStoreSpi
spiImpl
private final String
type
private final CertStoreParameters
certStoreParams
Constructors Summary
protected CertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params)
Creates a new {@code CertStore} instance.

param
storeSpi the implementation delegate.
param
provider the security provider.
param
type the certificate store type.
param
params the certificate store parameters (may be {@code null}.
since
Android 1.0


                                                                                         
          
              
        this.provider = provider;
        this.type = type;
        this.spiImpl = storeSpi;
        this.certStoreParams = params;
    
Methods Summary
public final java.util.CollectiongetCRLs(java.security.cert.CRLSelector selector)
Returns the list of {@code CRL}s for the specified {@code CRLSelector} from this certificate store.

param
selector the selector containing the criteria to search for certificate revocation lists in this store.
return
the list of {@code CRL}s that match the criteria of the specified selector
throws
CertStoreException if error(s) occur.
since
Android 1.0

        return spiImpl.engineGetCRLs(selector);
    
public final java.security.cert.CertStoreParametersgetCertStoreParameters()
Returns a copy of the certificate store parameters that were used to initialize this instance.

return
a copy of the certificate store parameters or {@code null} if none were specified.
since
Android 1.0

        if (certStoreParams == null) {
            return null;
        } else {
            return (CertStoreParameters) certStoreParams.clone();
        }
    
public final java.util.CollectiongetCertificates(java.security.cert.CertSelector selector)
Returns the list of {@code Certificate}s for the specified {@code CertSelector} from this certificate store.

param
selector the selector containing the criteria to search for certificates in this certificate store.
return
the list of {@code Certificate}s that match the criteria of the specified selector.
throws
CertStoreException if error(s) occur.
since
Android 1.0

        return spiImpl.engineGetCertificates(selector);
    
public static final java.lang.StringgetDefaultType()
Returns the default {@code CertStore} type from the Security Properties.

return
the default {@code CertStore} type from the Security Properties, or the string {@code "LDAP"} if it cannot be determined.
since
Android 1.0

        String defaultType = AccessController
                .doPrivileged(new java.security.PrivilegedAction<String>() {
                    public String run() {
                        return Security.getProperty(PROPERTYNAME);
                    }
                });
        return (defaultType == null ? DEFAULTPROPERTY : defaultType);
    
public static java.security.cert.CertStoregetInstance(java.lang.String type, java.security.cert.CertStoreParameters params)
Creates a new {@code CertStore} instance with the specified type and initialized with the specified parameters.

param
type the certificate store type.
param
params the certificate store parameters (may be {@code null}).
return
the new certificate store instance.
throws
NoSuchAlgorithmException if no provider can provide the specified certificate store type.
throws
InvalidAlgorithmParameterException if the specified parameters cannot be used to initialize this certificate store instance.
throws
NullPointerException if the {@code type} is {@code null}.
since
Android 1.0

        if (type == null) {
            throw new NullPointerException(Messages.getString("security.07")); //$NON-NLS-1$
        }
        try {
            synchronized (engine) {
                engine.getInstance(type, params);
                return new CertStore((CertStoreSpi) engine.spi, engine.provider,
                        type, params);
            }
        } catch (NoSuchAlgorithmException e) {
            Throwable th = e.getCause();
            if (th == null) {
                throw e;
            } else {
                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
            }
        }
    
public static java.security.cert.CertStoregetInstance(java.lang.String type, java.security.cert.CertStoreParameters params, java.lang.String provider)
Creates a new {@code CertStore} instance from the specified provider with the specified type and initialized with the specified parameters.

param
type the certificate store type.
param
params the certificate store parameters (may be {@code null}).
param
provider the name of the provider.
return
the new certificate store instance.
throws
NoSuchAlgorithmException if the specified provider cannot provide the requested certificate store type.
throws
NoSuchProviderException if no provider with the specified name can be found.
throws
InvalidAlgorithmParameterException if the specified parameters cannot be used to initialize this certificate store instance.
throws
IllegalArgumentException if provider is null of empty.
throws
NullPointerException if {@code type} is {@code null}.
since
Android 1.0

        if ((provider == null) || (provider.length() == 0)) {
            throw new IllegalArgumentException(Messages.getString("security.02")); //$NON-NLS-1$
        }
        Provider impProvider = Security.getProvider(provider);
        if (impProvider == null) {
            throw new NoSuchProviderException(provider);
        }
        return getInstance(type, params, impProvider);
    
public static java.security.cert.CertStoregetInstance(java.lang.String type, java.security.cert.CertStoreParameters params, java.security.Provider provider)
Creates a new {@code CertStore} instance from the specified provider with the specified type and initialized with the specified parameters.

param
type the certificate store type.
param
params the certificate store parameters (may be {@code null}).
param
provider the name of the provider.
return
the new certificate store instance.
throws
NoSuchAlgorithmException if the specified provider cannot provide the requested certificate store type.
throws
InvalidAlgorithmParameterException if the specified parameters cannot be used to initialize this certificate store instance.
throws
IllegalArgumentException if provider is {@code null}.
throws
NullPointerException if {@code type} is {@code null}.
since
Android 1.0

        if (provider == null) {
            throw new IllegalArgumentException(Messages.getString("security.04")); //$NON-NLS-1$
        }
        if (type == null) {
            throw new NullPointerException(Messages.getString("security.07")); //$NON-NLS-1$
        }
        try {
            synchronized (engine) {
                engine.getInstance(type, provider, params);
                return new CertStore((CertStoreSpi) engine.spi, provider, type,
                        params);
            }
        } catch (NoSuchAlgorithmException e) {
            Throwable th = e.getCause();
            if (th == null) {
                throw e;
            } else {
                throw new InvalidAlgorithmParameterException(e.getMessage(), th);
            }
        }
    
public final java.security.ProvidergetProvider()
Returns the security provider.

return
the security provider.
since
Android 1.0

        return provider;
    
public final java.lang.StringgetType()
Returns the certificate store type.

return
the certificate store type.
since
Android 1.0

        return type;