History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/security/ssl/SSLServerSocketFactoryImpl.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/security/ssl/SSLServerSocketFactoryImpl.java+119−0
@@ -0,0 +1,119 @@
1+/*
2+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
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
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
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+ *
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.
24+ */
25+
26+package sun.security.ssl;
27+
28+import java.io.IOException;
29+import java.net.InetAddress;
30+import java.net.ServerSocket;
31+
32+import javax.net.ssl.SSLServerSocketFactory;
33+
34+/**
35+ * This class creates SSL server sockets.
36+ *
37+ * @author David Brownell
38+ */
39+final
40+public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
41+{
42+ private static final int DEFAULT_BACKLOG = 50;
43+ private SSLContextImpl context;
44+
45+
46+ /**
47+ * Constructor used to instantiate the default factory. This method is
48+ * only called if the old "ssl.ServerSocketFactory.provider" property in the
49+ * java.security file is set.
50+ */
51+ public SSLServerSocketFactoryImpl() throws Exception {
52+ this.context = SSLContextImpl.DefaultSSLContext.getDefaultImpl();
53+ }
54+
55+ /**
56+ * Called from SSLContextImpl's getSSLServerSocketFactory().
57+ */
58+ SSLServerSocketFactoryImpl (SSLContextImpl context)
59+ {
60+ this.context = context;
61+ }
62+
63+ /**
64+ * Returns an unbound server socket.
65+ *
66+ * @return the unbound socket
67+ * @throws IOException if the socket cannot be created
68+ * @see java.net.Socket#bind(java.net.SocketAddress)
69+ */
70+ public ServerSocket createServerSocket() throws IOException {
71+ return new SSLServerSocketImpl(context);
72+ }
73+
74+ public ServerSocket createServerSocket (int port)
75+ throws IOException
76+ {
77+ return new SSLServerSocketImpl (port, DEFAULT_BACKLOG, context);
78+ }
79+
80+
81+ public ServerSocket createServerSocket (int port, int backlog)
82+ throws IOException
83+ {
84+ return new SSLServerSocketImpl (port, backlog, context);
85+ }
86+
87+ public ServerSocket
88+ createServerSocket (int port, int backlog, InetAddress ifAddress)
89+ throws IOException
90+ {
91+ return new SSLServerSocketImpl (port, backlog, ifAddress, context);
92+ }
93+
94+ /**
95+ * Returns the subset of the supported cipher suites which are
96+ * enabled by default. These cipher suites all provide a minimum
97+ * quality of service whereby the server authenticates itself
98+ * (preventing person-in-the-middle attacks) and where traffic
99+ * is encrypted to provide confidentiality.
100+ */
101+ public String[] getDefaultCipherSuites() {
102+ return context.getDefaultCipherSuiteList(true).toStringArray();
103+ }
104+
105+ /**
106+ * Returns the names of the cipher suites which could be enabled for use
107+ * on an SSL connection. Normally, only a subset of these will actually
108+ * be enabled by default, since this list may include cipher suites which
109+ * do not support the mutual authentication of servers and clients, or
110+ * which do not protect data confidentiality. Servers may also need
111+ * certain kinds of certificates to use certain cipher suites.
112+ *
113+ * @return an array of cipher suite names
114+ */
115+ public String[] getSupportedCipherSuites() {
116+ return context.getSuportedCipherSuiteList().toStringArray();
117+ }
118+
119+}