static List getSniHostName(byte[] hostname) { if (hostname == null || hostname.length == 0) { return Collections.emptyList(); } return Collections.singletonList(new SNIHostName(hostname)); }
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 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); }
@SuppressWarnings("unchecked") static boolean checkSniHostnameMatch(Collection<?> matchers, byte[] hostname) { if (matchers != null && !matchers.isEmpty()) { SNIHostName name = new SNIHostName(hostname); Iterator<SNIMatcher> matcherIt = (Iterator<SNIMatcher>) matchers.iterator(); while (matcherIt.hasNext()) { SNIMatcher matcher = matcherIt.next(); // type 0 is for hostname if (matcher.getType() == 0 && matcher.matches(name)) { return true; } } return false; } return true; } }
@Override public void enableSni(final String host, final SSLParameters sslParameters) { try { SNIServerName sniHostName = new SNIHostName(host); sslParameters.setServerNames(singletonList(sniHostName)); } catch (IllegalArgumentException e) { // ignore because SNIHostName will throw this for some legit host names for connecting to MongoDB, e.g an IPV6 literal } }
@SuppressWarnings("unchecked") static boolean checkSniHostnameMatch(Collection<?> matchers, byte[] hostname) { if (matchers != null && !matchers.isEmpty()) { SNIHostName name = new SNIHostName(hostname); Iterator<SNIMatcher> matcherIt = (Iterator<SNIMatcher>) matchers.iterator(); while (matcherIt.hasNext()) { SNIMatcher matcher = matcherIt.next(); // type 0 is for hostname if (matcher.getType() == 0 && matcher.matches(name)) { return true; } } return false; } return true; } }
sslParameters.setServerNames(Collections.singletonList(new SNIHostName(serverName))); engine.setSSLParameters(sslParameters);
public void handleEvent(final StreamConnection connection) { try { SSLEngine sslEngine = JsseSslUtils.createSSLEngine(sslContext, optionMap, destination); SSLParameters params = sslEngine.getSSLParameters(); params.setServerNames(Collections.singletonList(new SNIHostName(destination.getHostString()))); sslEngine.setSSLParameters(params); final SslConnection wrappedConnection = new UndertowSslConnection(connection, sslEngine, bufferPool); if (!futureResult.setResult(wrappedConnection)) { IoUtils.safeClose(connection); } else { ChannelListeners.invokeChannelListener(wrappedConnection, openListener); } } catch (Throwable e) { futureResult.setException(new IOException(e)); } } }
throw UndertowMessages.MESSAGES.emptyHostNameSni(); serverName = new SNIHostName(encoded); break; default:
throw ElytronMessages.log.emptyHostNameSni(); serverName = new SNIHostName(encoded); break; default:
throw log.emptyHostNameSni(); // TODO Check Type serverName = new SNIHostName(encoded); break; default:
static List getSniHostName(byte[] hostname) { if (hostname == null || hostname.length == 0) { return Collections.emptyList(); } return Collections.singletonList(new SNIHostName(hostname)); }
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; }
@SuppressWarnings("unchecked") static boolean checkSniHostnameMatch(Collection<?> matchers, byte[] hostname) { if (matchers != null && !matchers.isEmpty()) { SNIHostName name = new SNIHostName(hostname); Iterator<SNIMatcher> matcherIt = (Iterator<SNIMatcher>) matchers.iterator(); while (matcherIt.hasNext()) { SNIMatcher matcher = matcherIt.next(); // type 0 is for hostname if (matcher.getType() == 0 && matcher.matches(name)) { return true; } } return false; } return true; } }
sslParameters.setServerNames(Collections.singletonList(new SNIHostName(serverName))); engine.setSSLParameters(sslParameters);
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); }
@Override public void enableSni(final String host, final SSLParameters sslParameters) { try { SNIServerName sniHostName = new SNIHostName(host); sslParameters.setServerNames(singletonList(sniHostName)); } catch (IllegalArgumentException e) { // ignore because SNIHostName will throw this for some legit host names for connecting to MongoDB, e.g an IPV6 literal } }
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 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); }
protected void prepareSocketForSni(SSLSocket socket) { if(!sniHostNames.isEmpty()) { List<SNIServerName> sniNames = new ArrayList<>(sniHostNames.size()); for(String sniHostName : sniHostNames) { sniNames.add(new SNIHostName(sniHostName)); } SSLParameters sslParameters = socket.getSSLParameters(); sslParameters.setServerNames(sniNames); socket.setSSLParameters(sslParameters); } }