author | ascarpino |
Sun, 13 May 2018 08:52:25 -0700 | |
branch | JDK-8145252-TLS13-branch |
changeset 56544 | ad120e0dfcfb |
parent 56542 | 56aaa6cb3693 |
child 56714 | 2d7e08d730b6 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
56542 | 2 |
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.security.ssl; |
|
27 |
||
28 |
import java.io.IOException; |
|
29 |
import java.net.InetAddress; |
|
30 |
import java.net.ServerSocket; |
|
31 |
import javax.net.ssl.SSLServerSocketFactory; |
|
32 |
||
33 |
/** |
|
34 |
* This class creates SSL server sockets. |
|
35 |
* |
|
36 |
* @author David Brownell |
|
37 |
*/ |
|
56542 | 38 |
final public |
39 |
class SSLServerSocketFactoryImpl extends SSLServerSocketFactory { |
|
2 | 40 |
private static final int DEFAULT_BACKLOG = 50; |
41 |
private SSLContextImpl context; |
|
42 |
||
43 |
||
44 |
/** |
|
45 |
* Constructor used to instantiate the default factory. This method is |
|
46 |
* only called if the old "ssl.ServerSocketFactory.provider" property in the |
|
47 |
* java.security file is set. |
|
48 |
*/ |
|
49 |
public SSLServerSocketFactoryImpl() throws Exception { |
|
9246
c459f79af46b
6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents:
5506
diff
changeset
|
50 |
this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl(); |
2 | 51 |
} |
52 |
||
53 |
/** |
|
54 |
* Called from SSLContextImpl's getSSLServerSocketFactory(). |
|
55 |
*/ |
|
56542 | 56 |
SSLServerSocketFactoryImpl(SSLContextImpl context) { |
2 | 57 |
this.context = context; |
58 |
} |
|
59 |
||
60 |
/** |
|
61 |
* Returns an unbound server socket. |
|
62 |
* |
|
63 |
* @return the unbound socket |
|
64 |
* @throws IOException if the socket cannot be created |
|
65 |
* @see java.net.Socket#bind(java.net.SocketAddress) |
|
66 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
67 |
@Override |
2 | 68 |
public ServerSocket createServerSocket() throws IOException { |
69 |
return new SSLServerSocketImpl(context); |
|
70 |
} |
|
71 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
72 |
@Override |
56542 | 73 |
public ServerSocket createServerSocket( |
74 |
int port) throws IOException { |
|
75 |
return new SSLServerSocketImpl (context, port, DEFAULT_BACKLOG); |
|
2 | 76 |
} |
77 |
||
78 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
79 |
@Override |
56542 | 80 |
public ServerSocket createServerSocket ( |
81 |
int port, int backlog) throws IOException { |
|
82 |
return new SSLServerSocketImpl (context, port, backlog); |
|
2 | 83 |
} |
84 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
85 |
@Override |
2 | 86 |
public ServerSocket |
56542 | 87 |
createServerSocket (int port, |
88 |
int backlog, InetAddress ifAddress) throws IOException { |
|
89 |
return new SSLServerSocketImpl (context, port, backlog, ifAddress); |
|
2 | 90 |
} |
91 |
||
92 |
/** |
|
93 |
* Returns the subset of the supported cipher suites which are |
|
94 |
* enabled by default. These cipher suites all provide a minimum |
|
95 |
* quality of service whereby the server authenticates itself |
|
96 |
* (preventing person-in-the-middle attacks) and where traffic |
|
97 |
* is encrypted to provide confidentiality. |
|
98 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
99 |
@Override |
2 | 100 |
public String[] getDefaultCipherSuites() { |
56542 | 101 |
return CipherSuite.namesOf(context.getDefaultCipherSuites(true)); |
2 | 102 |
} |
103 |
||
104 |
/** |
|
105 |
* Returns the names of the cipher suites which could be enabled for use |
|
106 |
* on an SSL connection. Normally, only a subset of these will actually |
|
107 |
* be enabled by default, since this list may include cipher suites which |
|
108 |
* do not support the mutual authentication of servers and clients, or |
|
109 |
* which do not protect data confidentiality. Servers may also need |
|
110 |
* certain kinds of certificates to use certain cipher suites. |
|
111 |
* |
|
112 |
* @return an array of cipher suite names |
|
113 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
114 |
@Override |
2 | 115 |
public String[] getSupportedCipherSuites() { |
56542 | 116 |
return CipherSuite.namesOf(context.getSupportedCipherSuites()); |
2 | 117 |
} |
118 |
} |