Refine search
static void setSniHostNames(SSLParameters sslParameters, List<String> names) { List<SNIServerName> sniServerNames = new ArrayList<SNIServerName>(names.size()); for (String name: names) { sniServerNames.add(new SNIHostName(name)); } sslParameters.setServerNames(sniServerNames); }
static List<String> getSniHostNames(SSLParameters sslParameters) { List<SNIServerName> names = sslParameters.getServerNames(); if (names == null || names.isEmpty()) { return Collections.emptyList(); } List<String> strings = new ArrayList<String>(names.size()); for (SNIServerName serverName : names) { if (serverName instanceof SNIHostName) { strings.add(((SNIHostName) serverName).getAsciiName()); } else { throw new IllegalArgumentException("Only " + SNIHostName.class.getName() + " instances are supported, but found: " + serverName); } } return strings; }
public Builder addMatch(String name, SSLContext context) { if (name.contains("*")) { wildcards.put(SNIHostName.createSNIMatcher(name), context); } else { exacts.put(SNIHostName.createSNIMatcher(name), context); } return this; } }
log.debug("SSL context params - need client auth: {} want client auth: {} endpoint id algorithm: {}", params.getNeedClientAuth(), params.getWantClientAuth(), params.getEndpointIdentificationAlgorithm()); String[] supportedProtocols = params.getProtocols(); if (supportedProtocols != null) { SNIMatcher matcher = SNIHostName.createSNIMatcher(""); Collection<SNIMatcher> matchers = new ArrayList<>(1); matchers.add(matcher);
ConsumerX<SSLEngine> x_sslEngineConf() { // some default actions need to be done before user actions ConsumerX<SSLEngine> userActions = this.sslEngineConf; return engine-> { SSLParameters sslParameters = engine.getSSLParameters(); { // host name verification. see HostnameChecker // this should always be enabled. if user wants to disable it, set it to null in userActions sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); // SNI // in sun's impl, a name like "localhost" won't be used as SNI. see SSLEngineImpl.init() // we want to fix that; it would be nice for local testing. List<SNIServerName> snList = sslParameters.getServerNames(); if(snList==null || snList.isEmpty()) { String host = engine.getPeerHost(); if(host!=null && _Dns.isValidDomain(host)) sslParameters.setServerNames(Collections.singletonList(new SNIHostName(host))); } } engine.setSSLParameters(sslParameters); userActions.accept(engine); }; }
public void setSNIServerNames(SSLEngine sslEngine, String peerHost) { SSLParameters sslParameters = new SSLParameters(); List<SNIServerName> serverNames = new ArrayList<>(); serverNames.add(new SNIHostName(peerHost)); sslParameters.setServerNames(serverNames); sslEngine.setSSLParameters(sslParameters); } }
sslParameters.setEndpointIdentificationAlgorithm(endpointIdentificationAlgorithm); engine.setSSLParameters(sslParameters); sslParameters.setServerNames(Collections.singletonList(new SNIHostName(serverName))); engine.setSSLParameters(sslParameters);
static void getSSLParameters( SSLParameters params, SSLParametersImpl impl, ConscryptEngine engine) { Java7PlatformUtil.getSSLParameters(params, impl); params.setUseCipherSuitesOrder(impl.getUseCipherSuitesOrder()); if (impl.getUseSni() && AddressUtils.isValidSniHostname(engine.getHostname())) { params.setServerNames(Collections.singletonList( (SNIServerName) new SNIHostName(engine.getHostname()))); } }
SSLParameters tlsParameters = new SSLParameters(); if (wantClientAuth) { tlsParameters.setWantClientAuth(true); tlsParameters.setNeedClientAuth(true); tlsParameters.setSNIMatchers(singleton(createSNIMatcher(tlsHostname))); if (applicationProtocols != null && applicationProtocols.length > 0) { setApplicationProtocols(tlsParameters, applicationProtocols);
static List getSniHostName(byte[] hostname) { if (hostname == null || hostname.length == 0) { return Collections.emptyList(); } return Collections.singletonList(new SNIHostName(hostname)); }
sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); engine.setSSLParameters(sslParameters); sslParameters.setSNIMatchers(Arrays.asList(SNIHostName.createSNIMatcher(sniHost))); engine.setSSLParameters(sslParameters);
static void setSSLParameters( SSLParameters params, SSLParametersImpl impl, AbstractConscryptSocket socket) { Java7PlatformUtil.setSSLParameters(params, impl); impl.setUseCipherSuitesOrder(params.getUseCipherSuitesOrder()); List<SNIServerName> serverNames = params.getServerNames(); if (serverNames != null) { for (SNIServerName serverName : serverNames) { if (serverName.getType() == SNI_HOST_NAME) { socket.setHostname(((SNIHostName) serverName).getAsciiName()); break; } } } }
public boolean matches(final SNIServerName sniServerName) { return sniServerName instanceof SNIHostName && predicate.test(((SNIHostName) sniServerName).getAsciiName()); } };
return new SNIHostName(encoded).getAsciiName();
public void setSNIServerNames(SSLEngine sslEngine, String peerHost) { SSLParameters sslParameters = new SSLParameters(); List<SNIServerName> serverNames = new ArrayList<>(); serverNames.add(new SNIHostName(peerHost)); sslParameters.setServerNames(serverNames); sslEngine.setSSLParameters(sslParameters); }
sslParameters.setEndpointIdentificationAlgorithm(endpointIdentificationAlgorithm); engine.setSSLParameters(sslParameters); sslParameters.setServerNames(Collections.singletonList(new SNIHostName(serverName))); engine.setSSLParameters(sslParameters);
static void getSSLParameters( SSLParameters params, SSLParametersImpl impl, ConscryptEngine engine) { Java7PlatformUtil.getSSLParameters(params, impl); params.setUseCipherSuitesOrder(impl.getUseCipherSuitesOrder()); if (impl.getUseSni() && AddressUtils.isValidSniHostname(engine.getHostname())) { params.setServerNames(Collections.singletonList( (SNIServerName) new SNIHostName(engine.getHostname()))); } }
static List getSniHostNames(List<String> names) { if (names == null || names.isEmpty()) { return Collections.emptyList(); } List<SNIServerName> sniServerNames = new ArrayList<SNIServerName>(names.size()); for (String name: names) { sniServerNames.add(new SNIHostName(name)); } return sniServerNames; }
static void setSSLParameters( SSLParameters params, SSLParametersImpl impl, AbstractConscryptSocket socket) { Java7PlatformUtil.setSSLParameters(params, impl); impl.setUseCipherSuitesOrder(params.getUseCipherSuitesOrder()); List<SNIServerName> serverNames = params.getServerNames(); if (serverNames != null) { for (SNIServerName serverName : serverNames) { if (serverName.getType() == SNI_HOST_NAME) { socket.setHostname(((SNIHostName) serverName).getAsciiName()); break; } } } }
String host = _host = ((SNIHostName)serverName).getAsciiName(); host = StringUtil.asciiToLowerCase(host);