Hi!
In my Android application I use apache HttpClient. How can I enable CRL check?
In Java SE I can use the following code:
[HIGH]PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(truststore, new X509CertSelector());
CollectionCertStoreParameters params = new CollectionCertStoreParameters(crls);
CertStore store = CertStore.getInstance("Collection", params);
pkixParams.addCertStore(store);
pkixParams.setRevocationEnabled(true);
ManagerFactoryParameters trustParams =
new CertPathTrustManagerParameters(pkixParams);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustParams);
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keystore, keystorePassword.toCharArray());
this.sslcontext = SSLContext.getInstance(algorithm);
this.sslcontext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);[/HIGH]
But it does not work in Android because there is no appropriate crypto provider.
In my Android application I use apache HttpClient. How can I enable CRL check?
In Java SE I can use the following code:
[HIGH]PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(truststore, new X509CertSelector());
CollectionCertStoreParameters params = new CollectionCertStoreParameters(crls);
CertStore store = CertStore.getInstance("Collection", params);
pkixParams.addCertStore(store);
pkixParams.setRevocationEnabled(true);
ManagerFactoryParameters trustParams =
new CertPathTrustManagerParameters(pkixParams);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustParams);
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keystore, keystorePassword.toCharArray());
this.sslcontext = SSLContext.getInstance(algorithm);
this.sslcontext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);[/HIGH]
But it does not work in Android because there is no appropriate crypto provider.