how to set my TrustManager[] in webdav
Flokmane <[email protected]>
| Newsgroups | gmane.comp.jakarta.slide.user |
|---|---|
| Organization | IratenSolutions |
| Message-ID | <[email protected]> |
Hi,
Is it possible to replace
"System.setProperty("javax.net.ssl.trustStore", truststore_name)" by
setting my trustManagers[] in webdav?
I have the certificate of the server and I want to use the following
code to create my trustManagers[] :
-----------------------------------------------------------------------
private TrustManager[] createMyTrustManagers(X509Certificate
certificate) {
TrustManager[] trustManagers = null;
KeyStore trustStore = KeyStore.getInstance("JKS");
trustStore.load(null, null);
trustStore.setCertificateEntry("server", certificate);
if (trustStore != null) {
TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance("JKS", "SunJSSE");
trustManagerFactory.init(trustStore);
trustManagers = trustManagerFactory.getTrustManagers();
}
......
return trustManagers;
}
Thanks in advance,
Fatiha.