Java Code Examples for com.gargoylesoftware.htmlunit.WebClientOptions#getSSLClientCertificatePassword()
The following examples show how to use
com.gargoylesoftware.htmlunit.WebClientOptions#getSSLClientCertificatePassword() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtmlUnitSSLConnectionSocketFactory.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Factory method that builds a new SSLConnectionSocketFactory. * @param options the current WebClientOptions * @return the SSLConnectionSocketFactory */ public static SSLConnectionSocketFactory buildSSLSocketFactory(final WebClientOptions options) { try { final String[] sslClientProtocols = options.getSSLClientProtocols(); final String[] sslClientCipherSuites = options.getSSLClientCipherSuites(); final boolean useInsecureSSL = options.isUseInsecureSSL(); if (!useInsecureSSL) { final KeyStore keyStore = options.getSSLClientCertificateStore(); final KeyStore trustStore = options.getSSLTrustStore(); return new HtmlUnitSSLConnectionSocketFactory(keyStore, keyStore == null ? null : options.getSSLClientCertificatePassword(), trustStore, useInsecureSSL, sslClientProtocols, sslClientCipherSuites); } // we need insecure SSL + SOCKS awareness String protocol = options.getSSLInsecureProtocol(); if (protocol == null) { protocol = "SSL"; } final SSLContext sslContext = SSLContext.getInstance(protocol); sslContext.init(getKeyManagers(options), new X509ExtendedTrustManager[] {new InsecureTrustManager()}, null); return new HtmlUnitSSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE, useInsecureSSL, sslClientProtocols, sslClientCipherSuites); } catch (final GeneralSecurityException e) { throw new RuntimeException(e); } }
Example 2
Source File: HtmlUnitSSLConnectionSocketFactory.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * Factory method that builds a new SSLConnectionSocketFactory. * @param options the current WebClientOptions * @return the SSLConnectionSocketFactory */ public static SSLConnectionSocketFactory buildSSLSocketFactory(final WebClientOptions options) { try { final String[] sslClientProtocols = options.getSSLClientProtocols(); final String[] sslClientCipherSuites = options.getSSLClientCipherSuites(); final boolean useInsecureSSL = options.isUseInsecureSSL(); if (!useInsecureSSL) { final KeyStore keyStore = options.getSSLClientCertificateStore(); final KeyStore trustStore = options.getSSLTrustStore(); return new HtmlUnitSSLConnectionSocketFactory(keyStore, keyStore == null ? null : options.getSSLClientCertificatePassword(), trustStore, useInsecureSSL, sslClientProtocols, sslClientCipherSuites); } // we need insecure SSL + SOCKS awareness String protocol = options.getSSLInsecureProtocol(); if (protocol == null) { protocol = "SSL"; } final SSLContext sslContext = SSLContext.getInstance(protocol); sslContext.init(getKeyManagers(options), new TrustManager[]{new InsecureTrustManager2()}, null); final SSLConnectionSocketFactory factory = new HtmlUnitSSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE, useInsecureSSL, sslClientProtocols, sslClientCipherSuites); return factory; } catch (final GeneralSecurityException e) { throw new RuntimeException(e); } }