author | xuelei |
Mon, 25 Jun 2018 13:41:39 -0700 | |
changeset 50768 | 68fa3d4026ea |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
50768 | 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 |
*/ |
|
50768 | 38 |
public final class SSLServerSocketFactoryImpl extends SSLServerSocketFactory { |
2 | 39 |
private static final int DEFAULT_BACKLOG = 50; |
50768 | 40 |
private final SSLContextImpl context; |
2 | 41 |
|
42 |
||
43 |
/** |
|
44 |
* Constructor used to instantiate the default factory. This method is |
|
45 |
* only called if the old "ssl.ServerSocketFactory.provider" property in the |
|
46 |
* java.security file is set. |
|
47 |
*/ |
|
48 |
public SSLServerSocketFactoryImpl() throws Exception { |
|
9246
c459f79af46b
6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents:
5506
diff
changeset
|
49 |
this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl(); |
2 | 50 |
} |
51 |
||
52 |
/** |
|
53 |
* Called from SSLContextImpl's getSSLServerSocketFactory(). |
|
54 |
*/ |
|
50768 | 55 |
SSLServerSocketFactoryImpl(SSLContextImpl context) { |
2 | 56 |
this.context = context; |
57 |
} |
|
58 |
||
59 |
/** |
|
60 |
* Returns an unbound server socket. |
|
61 |
* |
|
62 |
* @return the unbound socket |
|
63 |
* @throws IOException if the socket cannot be created |
|
64 |
* @see java.net.Socket#bind(java.net.SocketAddress) |
|
65 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
66 |
@Override |
2 | 67 |
public ServerSocket createServerSocket() throws IOException { |
68 |
return new SSLServerSocketImpl(context); |
|
69 |
} |
|
70 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
71 |
@Override |
50768 | 72 |
public ServerSocket createServerSocket(int port) throws IOException { |
73 |
return new SSLServerSocketImpl(context, port, DEFAULT_BACKLOG); |
|
2 | 74 |
} |
75 |
||
76 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
77 |
@Override |
50768 | 78 |
public ServerSocket createServerSocket ( |
79 |
int port, int backlog) throws IOException { |
|
80 |
return new SSLServerSocketImpl(context, port, backlog); |
|
2 | 81 |
} |
82 |
||
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
83 |
@Override |
2 | 84 |
public ServerSocket |
50768 | 85 |
createServerSocket (int port, |
86 |
int backlog, InetAddress ifAddress) throws IOException { |
|
87 |
return new SSLServerSocketImpl(context, port, backlog, ifAddress); |
|
2 | 88 |
} |
89 |
||
90 |
/** |
|
91 |
* Returns the subset of the supported cipher suites which are |
|
92 |
* enabled by default. These cipher suites all provide a minimum |
|
93 |
* quality of service whereby the server authenticates itself |
|
94 |
* (preventing person-in-the-middle attacks) and where traffic |
|
95 |
* is encrypted to provide confidentiality. |
|
96 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
97 |
@Override |
2 | 98 |
public String[] getDefaultCipherSuites() { |
50768 | 99 |
return CipherSuite.namesOf(context.getDefaultCipherSuites(true)); |
2 | 100 |
} |
101 |
||
102 |
/** |
|
103 |
* Returns the names of the cipher suites which could be enabled for use |
|
104 |
* on an SSL connection. Normally, only a subset of these will actually |
|
105 |
* be enabled by default, since this list may include cipher suites which |
|
106 |
* do not support the mutual authentication of servers and clients, or |
|
107 |
* which do not protect data confidentiality. Servers may also need |
|
108 |
* certain kinds of certificates to use certain cipher suites. |
|
109 |
* |
|
110 |
* @return an array of cipher suite names |
|
111 |
*/ |
|
14664
e71aa0962e70
8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents:
13815
diff
changeset
|
112 |
@Override |
2 | 113 |
public String[] getSupportedCipherSuites() { |
50768 | 114 |
return CipherSuite.namesOf(context.getSupportedCipherSuites()); |
2 | 115 |
} |
116 |
} |