Java Code Examples for javax.net.ssl.SNIHostName#createSNIMatcher()
The following examples show how to use
javax.net.ssl.SNIHostName#createSNIMatcher() .
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: SSLEngineTestCase.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns server ssl engine. * * @param context - SSLContext to get SSLEngine from. * @param useSNI - flag used to enable or disable using SNI extension. * Needed for Kerberos. */ public static SSLEngine getServerSSLEngine( SSLContext context, boolean useSNI) { SSLEngine serverEngine = context.createSSLEngine(); serverEngine.setUseClientMode(false); if (useSNI) { SNIMatcher matcher = SNIHostName.createSNIMatcher(SNI_PATTERN); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = serverEngine.getSSLParameters(); params.setSNIMatchers(matchers); serverEngine.setSSLParameters(params); } return serverEngine; }
Example 2
Source File: UnboundSSLUtils.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 3
Source File: UnboundSSLUtils.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 4
Source File: UnboundSSLUtils.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 5
Source File: UnboundSSLUtils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 6
Source File: UnboundSSLUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 7
Source File: UnboundSSLUtils.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }
Example 8
Source File: UnboundSSLUtils.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
static SSLEchoServer init(String cipherSuiteFilter, String sniPattern) throws NoSuchAlgorithmException, IOException { SSLContext context = SSLContext.getDefault(); SSLServerSocketFactory ssf = (SSLServerSocketFactory) context.getServerSocketFactory(); SSLServerSocket ssocket = (SSLServerSocket) ssf.createServerSocket(0); // specify enabled cipher suites if (cipherSuiteFilter != null) { String[] ciphersuites = UnboundSSLUtils.filterStringArray( ssf.getSupportedCipherSuites(), cipherSuiteFilter); System.out.println("Server: enabled cipher suites: " + Arrays.toString(ciphersuites)); ssocket.setEnabledCipherSuites(ciphersuites); } // specify SNI matcher pattern if (sniPattern != null) { System.out.println("Server: set SNI matcher: " + sniPattern); SNIMatcher matcher = SNIHostName.createSNIMatcher(sniPattern); List<SNIMatcher> matchers = new ArrayList<>(); matchers.add(matcher); SSLParameters params = ssocket.getSSLParameters(); params.setSNIMatchers(matchers); ssocket.setSSLParameters(params); } return new SSLEchoServer(ssocket); }