001/* SSLServerSocket.java -- a server socket for SSL connections.
002   Copyright (C) 2004 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package javax.net.ssl;
040
041import java.io.IOException;
042
043import java.net.InetAddress;
044import java.net.ServerSocket;
045
046/**
047 * A server socket that allows clients to connect via the SSL protocol.
048 */
049public abstract class SSLServerSocket extends ServerSocket
050{
051
052  // Constructors.
053  // -------------------------------------------------------------------------
054
055  protected SSLServerSocket() throws IOException
056  {
057    super();
058    //super(0);
059    //throw new UnsupportedOperationException("1.4 socket methods not enabled");
060  }
061
062  protected SSLServerSocket(int port) throws IOException
063  {
064    super(port);
065  }
066
067  protected SSLServerSocket(int port, int backlog) throws IOException
068  {
069    super(port, backlog);
070  }
071
072  protected SSLServerSocket(int port, int backlog, InetAddress bindAddress)
073    throws IOException
074  {
075    super(port, backlog, bindAddress);
076  }
077
078  // Abstract methods.
079  // -------------------------------------------------------------------------
080
081  /**
082   * Returns the list of cihper suites that are currently enabled in this
083   * server socket. Sockets accepted by this server socket will only have
084   * these suites enabled.
085   *
086   * @return The enabled cipher suites.
087   */
088  public abstract String[] getEnabledCipherSuites();
089
090  /**
091   * Sets the list enabled cipher suites.
092   *
093   * @param suites The cipher suites to enable.
094   */
095  public abstract void setEnabledCipherSuites(String[] suites);
096
097  /**
098   * Returns the list of enabled protocols, such as "SSLv3" and "TLSv1".
099   *
100   * @return The enabled protocols.
101   */
102  public abstract String[] getEnabledProtocols();
103
104  /**
105   * Sets the list of enabled protocols.
106   *
107   * @param protocols The list of protocols to enable.
108   */
109  public abstract void setEnabledProtocols(String[] protocols);
110
111  /**
112   * Returns whether or not sessions will be created, i.e., whether or not
113   * this server socket will allow SSL session resumption.
114   *
115   * @return True if sessions will be created.
116   */
117  public abstract boolean getEnableSessionCreation();
118
119  /**
120   * Sets whether or not sessions will be created.
121   *
122   * @param enabled The new enabled value.
123   */
124  public abstract void setEnableSessionCreation(boolean enabled);
125
126  /**
127   * Returns whether or not this server socket will require clients to
128   * authenticate themselves, such as through a certificate.
129   *
130   * @return True if clients must authenticate themselves.
131   */
132  public abstract boolean getNeedClientAuth();
133
134  /**
135   * Enabled or disables the requirement that clients authenticate themselves.
136   * When this is set to <code>true</code>, connections will be rejected if
137   * connecting clients do not provide proper authentication.
138   *
139   * @param needAuth The new need auth value.
140   */
141  public abstract void setNeedClientAuth(boolean needAuth);
142
143  /**
144   * Returns whether or not sockets accepted by this server socket will do
145   * their handshake as the client-side. The default is false.
146   *
147   * @return True if client mode will be used.
148   */
149  public abstract boolean getUseClientMode();
150
151  /**
152   * Sets whether or not sockets accepted by this server socket will be
153   * created in client mode.
154   *
155   * @param clientMode The new client mode value.
156   */
157  public abstract void setUseClientMode(boolean clientMode);
158
159  /**
160   * Returns whether or not this socket will ask for, but not require, that
161   * connecting clients authenticate themselves. Clients that do not
162   * provide authentication they will still be allowed to connect.
163   *
164   * @return True if this server socket wants client authentication.
165   */
166  public abstract boolean getWantClientAuth();
167
168  /**
169   * Sets whether or not this server socket will want client authentication.
170   *
171   * @param wantAuth The new want auth value.
172   */
173  public abstract void setWantClientAuth(boolean wantAuth);
174
175  /**
176   * Returns a list of cipher suites that this server socket supports.
177   *
178   * @return The list of supported suites.
179   */
180  public abstract String[] getSupportedCipherSuites();
181
182  /**
183   * Returns a list of SSL protocols supported by this server socket.
184   *
185   * @return The list of supported protocols.
186   */
187  public abstract String[] getSupportedProtocols();
188}