1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package sun.security.ssl; |
26 package sun.security.ssl; |
27 |
27 |
28 import java.io.IOException; |
28 import java.io.IOException; |
29 import java.net.InetAddress; |
29 import java.net.InetAddress; |
30 import java.net.ServerSocket; |
30 import java.net.ServerSocket; |
31 |
|
32 import javax.net.ssl.SSLServerSocketFactory; |
31 import javax.net.ssl.SSLServerSocketFactory; |
33 |
32 |
34 /** |
33 /** |
35 * This class creates SSL server sockets. |
34 * This class creates SSL server sockets. |
36 * |
35 * |
37 * @author David Brownell |
36 * @author David Brownell |
38 */ |
37 */ |
39 final |
38 final public |
40 public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory |
39 class SSLServerSocketFactoryImpl extends SSLServerSocketFactory { |
41 { |
|
42 private static final int DEFAULT_BACKLOG = 50; |
40 private static final int DEFAULT_BACKLOG = 50; |
43 private SSLContextImpl context; |
41 private SSLContextImpl context; |
44 |
42 |
45 |
43 |
46 /** |
44 /** |
71 public ServerSocket createServerSocket() throws IOException { |
68 public ServerSocket createServerSocket() throws IOException { |
72 return new SSLServerSocketImpl(context); |
69 return new SSLServerSocketImpl(context); |
73 } |
70 } |
74 |
71 |
75 @Override |
72 @Override |
76 public ServerSocket createServerSocket (int port) |
73 public ServerSocket createServerSocket( |
77 throws IOException |
74 int port) throws IOException { |
78 { |
75 return new SSLServerSocketImpl (context, port, DEFAULT_BACKLOG); |
79 return new SSLServerSocketImpl (port, DEFAULT_BACKLOG, context); |
|
80 } |
76 } |
81 |
77 |
82 |
78 |
83 @Override |
79 @Override |
84 public ServerSocket createServerSocket (int port, int backlog) |
80 public ServerSocket createServerSocket ( |
85 throws IOException |
81 int port, int backlog) throws IOException { |
86 { |
82 return new SSLServerSocketImpl (context, port, backlog); |
87 return new SSLServerSocketImpl (port, backlog, context); |
|
88 } |
83 } |
89 |
84 |
90 @Override |
85 @Override |
91 public ServerSocket |
86 public ServerSocket |
92 createServerSocket (int port, int backlog, InetAddress ifAddress) |
87 createServerSocket (int port, |
93 throws IOException |
88 int backlog, InetAddress ifAddress) throws IOException { |
94 { |
89 return new SSLServerSocketImpl (context, port, backlog, ifAddress); |
95 return new SSLServerSocketImpl (port, backlog, ifAddress, context); |
|
96 } |
90 } |
97 |
91 |
98 /** |
92 /** |
99 * Returns the subset of the supported cipher suites which are |
93 * Returns the subset of the supported cipher suites which are |
100 * enabled by default. These cipher suites all provide a minimum |
94 * enabled by default. These cipher suites all provide a minimum |
102 * (preventing person-in-the-middle attacks) and where traffic |
96 * (preventing person-in-the-middle attacks) and where traffic |
103 * is encrypted to provide confidentiality. |
97 * is encrypted to provide confidentiality. |
104 */ |
98 */ |
105 @Override |
99 @Override |
106 public String[] getDefaultCipherSuites() { |
100 public String[] getDefaultCipherSuites() { |
107 return context.getDefaultCipherSuiteList(true).toStringArray(); |
101 return CipherSuite.namesOf(context.getDefaultCipherSuites(true)); |
108 } |
102 } |
109 |
103 |
110 /** |
104 /** |
111 * Returns the names of the cipher suites which could be enabled for use |
105 * Returns the names of the cipher suites which could be enabled for use |
112 * on an SSL connection. Normally, only a subset of these will actually |
106 * on an SSL connection. Normally, only a subset of these will actually |