public void setNeedClientAuth(final boolean needClientAuth) { delegate.setNeedClientAuth(needClientAuth); }
/** * Creates a SSLContext instance using the given information. * * * @return a SSLContext instance * @throws java.security.KeyStoreException if problem with keystore * @throws java.io.IOException if unable to create context * @throws java.security.NoSuchAlgorithmException if algorithm isn't known * @throws java.security.cert.CertificateException if certificate is invalid * @throws java.security.UnrecoverableKeyException if the key cannot be recovered * @throws java.security.KeyManagementException if the key is improper */ public SSLContext createSslContext() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException, KeyManagementException { // initialize the ssl context final SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); sslContext.getDefaultSSLParameters().setNeedClientAuth(true); return sslContext; } }
switch (clientAuth) { case NEED: sslParameters.setNeedClientAuth(true); break; case WANT: break; default: sslParameters.setNeedClientAuth(false); // also clears the wantClientAuth flag according to docs break;
final SSLContext sslContext = SSLContext.getInstance(getProtocol()); sslContext.init(keyManagers, trustManagers, new SecureRandom()); sslContext.getDefaultSSLParameters().setNeedClientAuth(true);
sslContext.getDefaultSSLParameters().setNeedClientAuth(true);
sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); if (ClientAuth.REQUIRED == clientAuth) { sslContext.getDefaultSSLParameters().setNeedClientAuth(true); } else if (ClientAuth.WANT == clientAuth) { sslContext.getDefaultSSLParameters().setWantClientAuth(true);
sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); sslContext.getDefaultSSLParameters().setNeedClientAuth(true);
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { Assert.checkNotNullParam("supportedProtocols", supportedProtocols); Assert.checkNotNullParam("supportedCipherSuites", supportedCipherSuites); params.setProtocols(protocolSelector.evaluate(supportedProtocols)); params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); // unsets need if (needClientAuth) params.setNeedClientAuth(needClientAuth); // unsets want }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }
private javax.net.ssl.SSLParameters createSSLParameters(boolean supported) { try { SSLSocket s = (SSLSocket) engineGetSocketFactory().createSocket(); javax.net.ssl.SSLParameters p = new javax.net.ssl.SSLParameters(); String[] cipherSuites; String[] protocols; if (supported) { cipherSuites = s.getSupportedCipherSuites(); protocols = s.getSupportedProtocols(); } else { cipherSuites = s.getEnabledCipherSuites(); protocols = s.getEnabledProtocols(); } p.setCipherSuites(cipherSuites); p.setProtocols(protocols); p.setNeedClientAuth(s.getNeedClientAuth()); p.setWantClientAuth(s.getWantClientAuth()); return p; } catch (IOException e) { /* * SSLContext.getDefaultSSLParameters specifies to throw * UnsupportedOperationException if there is a problem getting the * parameters */ throw new UnsupportedOperationException("Could not access supported SSL parameters"); } } }
/** * Customize an SslParameters instance with the configuration of this factory. * * @param sslParams The parameters to customize * @return The passed instance of sslParams (returned as a convenience) */ public SSLParameters customize(SSLParameters sslParams) { sslParams.setEndpointIdentificationAlgorithm(getEndpointIdentificationAlgorithm()); sslParams.setUseCipherSuitesOrder(isUseCipherSuitesOrder()); if (!_certHosts.isEmpty() || !_certWilds.isEmpty()) sslParams.setSNIMatchers(Collections.singletonList(new AliasSNIMatcher())); if (_selectedCipherSuites != null) sslParams.setCipherSuites(_selectedCipherSuites); if (_selectedProtocols != null) sslParams.setProtocols(_selectedProtocols); if (getWantClientAuth()) sslParams.setWantClientAuth(true); if (getNeedClientAuth()) sslParams.setNeedClientAuth(true); return sslParams; }
public void configure(SSLParameters sslParameters) { sslParameters.setNeedClientAuth(true); } };
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { Assert.checkNotNullParam("supportedProtocols", supportedProtocols); Assert.checkNotNullParam("supportedCipherSuites", supportedCipherSuites); params.setProtocols(protocolSelector.evaluate(supportedProtocols)); params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); // unsets need if (needClientAuth) params.setNeedClientAuth(needClientAuth); // unsets want }
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { Assert.checkNotNullParam("supportedProtocols", supportedProtocols); Assert.checkNotNullParam("supportedCipherSuites", supportedCipherSuites); params.setProtocols(protocolSelector.evaluate(supportedProtocols)); params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); // unsets need if (needClientAuth) params.setNeedClientAuth(needClientAuth); // unsets want }
void configure(SSLParameters params, String[] supportedProtocols, String[] supportedCipherSuites) { Assert.checkNotNullParam("supportedProtocols", supportedProtocols); Assert.checkNotNullParam("supportedCipherSuites", supportedCipherSuites); params.setProtocols(protocolSelector.evaluate(supportedProtocols)); params.setCipherSuites(cipherSuiteSelector.evaluate(supportedCipherSuites)); params.setUseCipherSuitesOrder(useCipherSuitesOrder); params.setWantClientAuth(wantClientAuth); // unsets need if (needClientAuth) params.setNeedClientAuth(needClientAuth); // unsets want }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }
/** * Returns a new SSLParameters based on this SSLSocket's current * cipher suites, protocols, and client authentication settings. * * @since 1.6 */ public SSLParameters getSSLParameters() { SSLParameters p = new SSLParameters(); p.setCipherSuites(getEnabledCipherSuites()); p.setProtocols(getEnabledProtocols()); p.setNeedClientAuth(getNeedClientAuth()); p.setWantClientAuth(getWantClientAuth()); return p; }