提交 a03ef49f 编写于 作者: X xuelei

8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl

Reviewed-by: xuelei
Contributed-by: NFlorian Weimer <fweimer@redhat.com>
上级 b58040be
...@@ -55,6 +55,7 @@ class AppInputStream extends InputStream { ...@@ -55,6 +55,7 @@ class AppInputStream extends InputStream {
* Return the minimum number of bytes that can be read without blocking. * Return the minimum number of bytes that can be read without blocking.
* Currently not synchronized. * Currently not synchronized.
*/ */
@Override
public int available() throws IOException { public int available() throws IOException {
if (c.checkEOF() || (r.isAppDataValid() == false)) { if (c.checkEOF() || (r.isAppDataValid() == false)) {
return 0; return 0;
...@@ -65,6 +66,7 @@ class AppInputStream extends InputStream { ...@@ -65,6 +66,7 @@ class AppInputStream extends InputStream {
/** /**
* Read a single byte, returning -1 on non-fault EOF status. * Read a single byte, returning -1 on non-fault EOF status.
*/ */
@Override
public synchronized int read() throws IOException { public synchronized int read() throws IOException {
int n = read(oneByte, 0, 1); int n = read(oneByte, 0, 1);
if (n <= 0) { // EOF if (n <= 0) { // EOF
...@@ -79,6 +81,7 @@ class AppInputStream extends InputStream { ...@@ -79,6 +81,7 @@ class AppInputStream extends InputStream {
* are responsible only for blocking to fill at most one buffer, * are responsible only for blocking to fill at most one buffer,
* and returning "-1" on non-fault EOF status. * and returning "-1" on non-fault EOF status.
*/ */
@Override
public synchronized int read(byte b[], int off, int len) public synchronized int read(byte b[], int off, int len)
throws IOException { throws IOException {
if (b == null) { if (b == null) {
...@@ -124,6 +127,7 @@ class AppInputStream extends InputStream { ...@@ -124,6 +127,7 @@ class AppInputStream extends InputStream {
* is static and may garbled by concurrent use, but we are not interested * is static and may garbled by concurrent use, but we are not interested
* in the data anyway. * in the data anyway.
*/ */
@Override
public synchronized long skip(long n) throws IOException { public synchronized long skip(long n) throws IOException {
long skipped = 0; long skipped = 0;
while (n > 0) { while (n > 0) {
...@@ -141,6 +145,7 @@ class AppInputStream extends InputStream { ...@@ -141,6 +145,7 @@ class AppInputStream extends InputStream {
/* /*
* Socket close is already synchronized, no need to block here. * Socket close is already synchronized, no need to block here.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
c.close(); c.close();
} }
......
...@@ -56,6 +56,7 @@ class AppOutputStream extends OutputStream { ...@@ -56,6 +56,7 @@ class AppOutputStream extends OutputStream {
/** /**
* Write the data out, NOW. * Write the data out, NOW.
*/ */
@Override
synchronized public void write(byte b[], int off, int len) synchronized public void write(byte b[], int off, int len)
throws IOException { throws IOException {
if (b == null) { if (b == null) {
...@@ -131,6 +132,7 @@ class AppOutputStream extends OutputStream { ...@@ -131,6 +132,7 @@ class AppOutputStream extends OutputStream {
/** /**
* Write one byte now. * Write one byte now.
*/ */
@Override
synchronized public void write(int i) throws IOException { synchronized public void write(int i) throws IOException {
oneByte[0] = (byte)i; oneByte[0] = (byte)i;
write(oneByte, 0, 1); write(oneByte, 0, 1);
...@@ -139,6 +141,7 @@ class AppOutputStream extends OutputStream { ...@@ -139,6 +141,7 @@ class AppOutputStream extends OutputStream {
/* /*
* Socket close is already synchronized, no need to block here. * Socket close is already synchronized, no need to block here.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
c.close(); c.close();
} }
......
...@@ -102,6 +102,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -102,6 +102,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* associated with this socket, if any. * associated with this socket, if any.
* @see java.net.Socket#getChannel * @see java.net.Socket#getChannel
*/ */
@Override
public final SocketChannel getChannel() { public final SocketChannel getChannel() {
if (self == this) { if (self == this) {
return super.getChannel(); return super.getChannel();
...@@ -114,6 +115,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -114,6 +115,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Binds the address to the socket. * Binds the address to the socket.
* @see java.net.Socket#bind * @see java.net.Socket#bind
*/ */
@Override
public void bind(SocketAddress bindpoint) throws IOException { public void bind(SocketAddress bindpoint) throws IOException {
/* /*
* Bind to this socket * Bind to this socket
...@@ -131,6 +133,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -131,6 +133,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the address of the endpoint this socket is connected to * Returns the address of the endpoint this socket is connected to
* @see java.net.Socket#getLocalSocketAddress * @see java.net.Socket#getLocalSocketAddress
*/ */
@Override
public SocketAddress getLocalSocketAddress() { public SocketAddress getLocalSocketAddress() {
if (self == this) { if (self == this) {
return super.getLocalSocketAddress(); return super.getLocalSocketAddress();
...@@ -143,6 +146,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -143,6 +146,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the address of the endpoint this socket is connected to * Returns the address of the endpoint this socket is connected to
* @see java.net.Socket#getRemoteSocketAddress * @see java.net.Socket#getRemoteSocketAddress
*/ */
@Override
public SocketAddress getRemoteSocketAddress() { public SocketAddress getRemoteSocketAddress() {
if (self == this) { if (self == this) {
return super.getRemoteSocketAddress(); return super.getRemoteSocketAddress();
...@@ -164,6 +168,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -164,6 +168,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* @param endpoint the <code>SocketAddress</code> * @param endpoint the <code>SocketAddress</code>
* @throws IOException if an error occurs during the connection * @throws IOException if an error occurs during the connection
*/ */
@Override
public final void connect(SocketAddress endpoint) throws IOException { public final void connect(SocketAddress endpoint) throws IOException {
connect(endpoint, 0); connect(endpoint, 0);
} }
...@@ -172,6 +177,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -172,6 +177,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the connection state of the socket. * Returns the connection state of the socket.
* @see java.net.Socket#isConnected * @see java.net.Socket#isConnected
*/ */
@Override
public final boolean isConnected() { public final boolean isConnected() {
if (self == this) { if (self == this) {
return super.isConnected(); return super.isConnected();
...@@ -184,6 +190,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -184,6 +190,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the binding state of the socket. * Returns the binding state of the socket.
* @see java.net.Socket#isBound * @see java.net.Socket#isBound
*/ */
@Override
public final boolean isBound() { public final boolean isBound() {
if (self == this) { if (self == this) {
return super.isBound(); return super.isBound();
...@@ -203,6 +210,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -203,6 +210,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* *
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
*/ */
@Override
public final void shutdownInput() throws IOException { public final void shutdownInput() throws IOException {
throw new UnsupportedOperationException("The method shutdownInput()" + throw new UnsupportedOperationException("The method shutdownInput()" +
" is not supported in SSLSocket"); " is not supported in SSLSocket");
...@@ -215,6 +223,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -215,6 +223,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* *
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
*/ */
@Override
public final void shutdownOutput() throws IOException { public final void shutdownOutput() throws IOException {
throw new UnsupportedOperationException("The method shutdownOutput()" + throw new UnsupportedOperationException("The method shutdownOutput()" +
" is not supported in SSLSocket"); " is not supported in SSLSocket");
...@@ -225,6 +234,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -225,6 +234,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the input state of the socket * Returns the input state of the socket
* @see java.net.Socket#isInputShutdown * @see java.net.Socket#isInputShutdown
*/ */
@Override
public final boolean isInputShutdown() { public final boolean isInputShutdown() {
if (self == this) { if (self == this) {
return super.isInputShutdown(); return super.isInputShutdown();
...@@ -237,6 +247,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -237,6 +247,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the output state of the socket * Returns the output state of the socket
* @see java.net.Socket#isOutputShutdown * @see java.net.Socket#isOutputShutdown
*/ */
@Override
public final boolean isOutputShutdown() { public final boolean isOutputShutdown() {
if (self == this) { if (self == this) {
return super.isOutputShutdown(); return super.isOutputShutdown();
...@@ -252,6 +263,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -252,6 +263,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* rather than forcing them to be explicitly reclaimed at * rather than forcing them to be explicitly reclaimed at
* the penalty of prematurly killing SSL sessions. * the penalty of prematurly killing SSL sessions.
*/ */
@Override
protected final void finalize() throws Throwable { protected final void finalize() throws Throwable {
try { try {
close(); close();
...@@ -281,6 +293,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -281,6 +293,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
/** /**
* Returns the address of the remote peer for this connection. * Returns the address of the remote peer for this connection.
*/ */
@Override
public final InetAddress getInetAddress() { public final InetAddress getInetAddress() {
if (self == this) { if (self == this) {
return super.getInetAddress(); return super.getInetAddress();
...@@ -295,6 +308,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -295,6 +308,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* @return the local address to which the socket is bound. * @return the local address to which the socket is bound.
* @since JDK1.1 * @since JDK1.1
*/ */
@Override
public final InetAddress getLocalAddress() { public final InetAddress getLocalAddress() {
if (self == this) { if (self == this) {
return super.getLocalAddress(); return super.getLocalAddress();
...@@ -306,6 +320,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -306,6 +320,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
/** /**
* Returns the number of the remote port that this connection uses. * Returns the number of the remote port that this connection uses.
*/ */
@Override
public final int getPort() { public final int getPort() {
if (self == this) { if (self == this) {
return super.getPort(); return super.getPort();
...@@ -317,6 +332,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -317,6 +332,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
/** /**
* Returns the number of the local port that this connection uses. * Returns the number of the local port that this connection uses.
*/ */
@Override
public final int getLocalPort() { public final int getLocalPort() {
if (self == this) { if (self == this) {
return super.getLocalPort(); return super.getLocalPort();
...@@ -333,6 +349,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -333,6 +349,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Enables or disables the Nagle optimization. * Enables or disables the Nagle optimization.
* @see java.net.Socket#setTcpNoDelay * @see java.net.Socket#setTcpNoDelay
*/ */
@Override
public final void setTcpNoDelay(boolean value) throws SocketException { public final void setTcpNoDelay(boolean value) throws SocketException {
if (self == this) { if (self == this) {
super.setTcpNoDelay(value); super.setTcpNoDelay(value);
...@@ -348,6 +365,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -348,6 +365,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* *
* @see java.net.Socket#getTcpNoDelay * @see java.net.Socket#getTcpNoDelay
*/ */
@Override
public final boolean getTcpNoDelay() throws SocketException { public final boolean getTcpNoDelay() throws SocketException {
if (self == this) { if (self == this) {
return super.getTcpNoDelay(); return super.getTcpNoDelay();
...@@ -360,6 +378,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -360,6 +378,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Assigns the socket's linger timeout. * Assigns the socket's linger timeout.
* @see java.net.Socket#setSoLinger * @see java.net.Socket#setSoLinger
*/ */
@Override
public final void setSoLinger(boolean flag, int linger) public final void setSoLinger(boolean flag, int linger)
throws SocketException { throws SocketException {
if (self == this) { if (self == this) {
...@@ -373,6 +392,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -373,6 +392,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the socket's linger timeout. * Returns the socket's linger timeout.
* @see java.net.Socket#getSoLinger * @see java.net.Socket#getSoLinger
*/ */
@Override
public final int getSoLinger() throws SocketException { public final int getSoLinger() throws SocketException {
if (self == this) { if (self == this) {
return super.getSoLinger(); return super.getSoLinger();
...@@ -388,6 +408,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -388,6 +408,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* this for an SSLSocket. An implementation can be provided if a need * this for an SSLSocket. An implementation can be provided if a need
* arises in future. * arises in future.
*/ */
@Override
public final void sendUrgentData(int data) throws SocketException { public final void sendUrgentData(int data) throws SocketException {
throw new SocketException("This method is not supported " throw new SocketException("This method is not supported "
+ "by SSLSockets"); + "by SSLSockets");
...@@ -401,6 +422,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -401,6 +422,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Setting OOBInline does not have any effect on SSLSocket, * Setting OOBInline does not have any effect on SSLSocket,
* since currently we don't support sending urgent data. * since currently we don't support sending urgent data.
*/ */
@Override
public final void setOOBInline(boolean on) throws SocketException { public final void setOOBInline(boolean on) throws SocketException {
throw new SocketException("This method is ineffective, since" throw new SocketException("This method is ineffective, since"
+ " sending urgent data is not supported by SSLSockets"); + " sending urgent data is not supported by SSLSockets");
...@@ -410,6 +432,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -410,6 +432,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Tests if OOBINLINE is enabled. * Tests if OOBINLINE is enabled.
* @see java.net.Socket#getOOBInline * @see java.net.Socket#getOOBInline
*/ */
@Override
public final boolean getOOBInline() throws SocketException { public final boolean getOOBInline() throws SocketException {
throw new SocketException("This method is ineffective, since" throw new SocketException("This method is ineffective, since"
+ " sending urgent data is not supported by SSLSockets"); + " sending urgent data is not supported by SSLSockets");
...@@ -419,6 +442,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -419,6 +442,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Returns the socket timeout. * Returns the socket timeout.
* @see java.net.Socket#getSoTimeout * @see java.net.Socket#getSoTimeout
*/ */
@Override
public final int getSoTimeout() throws SocketException { public final int getSoTimeout() throws SocketException {
if (self == this) { if (self == this) {
return super.getSoTimeout(); return super.getSoTimeout();
...@@ -427,6 +451,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -427,6 +451,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
} }
} }
@Override
public final void setSendBufferSize(int size) throws SocketException { public final void setSendBufferSize(int size) throws SocketException {
if (self == this) { if (self == this) {
super.setSendBufferSize(size); super.setSendBufferSize(size);
...@@ -435,6 +460,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -435,6 +460,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
} }
} }
@Override
public final int getSendBufferSize() throws SocketException { public final int getSendBufferSize() throws SocketException {
if (self == this) { if (self == this) {
return super.getSendBufferSize(); return super.getSendBufferSize();
...@@ -443,6 +469,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -443,6 +469,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
} }
} }
@Override
public final void setReceiveBufferSize(int size) throws SocketException { public final void setReceiveBufferSize(int size) throws SocketException {
if (self == this) { if (self == this) {
super.setReceiveBufferSize(size); super.setReceiveBufferSize(size);
...@@ -451,6 +478,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -451,6 +478,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
} }
} }
@Override
public final int getReceiveBufferSize() throws SocketException { public final int getReceiveBufferSize() throws SocketException {
if (self == this) { if (self == this) {
return super.getReceiveBufferSize(); return super.getReceiveBufferSize();
...@@ -463,6 +491,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -463,6 +491,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Enable/disable SO_KEEPALIVE. * Enable/disable SO_KEEPALIVE.
* @see java.net.Socket#setKeepAlive * @see java.net.Socket#setKeepAlive
*/ */
@Override
public final void setKeepAlive(boolean on) throws SocketException { public final void setKeepAlive(boolean on) throws SocketException {
if (self == this) { if (self == this) {
super.setKeepAlive(on); super.setKeepAlive(on);
...@@ -475,6 +504,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -475,6 +504,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Tests if SO_KEEPALIVE is enabled. * Tests if SO_KEEPALIVE is enabled.
* @see java.net.Socket#getKeepAlive * @see java.net.Socket#getKeepAlive
*/ */
@Override
public final boolean getKeepAlive() throws SocketException { public final boolean getKeepAlive() throws SocketException {
if (self == this) { if (self == this) {
return super.getKeepAlive(); return super.getKeepAlive();
...@@ -488,6 +518,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -488,6 +518,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* packets sent from this Socket. * packets sent from this Socket.
* @see java.net.Socket#setTrafficClass * @see java.net.Socket#setTrafficClass
*/ */
@Override
public final void setTrafficClass(int tc) throws SocketException { public final void setTrafficClass(int tc) throws SocketException {
if (self == this) { if (self == this) {
super.setTrafficClass(tc); super.setTrafficClass(tc);
...@@ -501,6 +532,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -501,6 +532,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* sent from this Socket. * sent from this Socket.
* @see java.net.Socket#getTrafficClass * @see java.net.Socket#getTrafficClass
*/ */
@Override
public final int getTrafficClass() throws SocketException { public final int getTrafficClass() throws SocketException {
if (self == this) { if (self == this) {
return super.getTrafficClass(); return super.getTrafficClass();
...@@ -513,6 +545,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -513,6 +545,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Enable/disable SO_REUSEADDR. * Enable/disable SO_REUSEADDR.
* @see java.net.Socket#setReuseAddress * @see java.net.Socket#setReuseAddress
*/ */
@Override
public final void setReuseAddress(boolean on) throws SocketException { public final void setReuseAddress(boolean on) throws SocketException {
if (self == this) { if (self == this) {
super.setReuseAddress(on); super.setReuseAddress(on);
...@@ -525,6 +558,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -525,6 +558,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* Tests if SO_REUSEADDR is enabled. * Tests if SO_REUSEADDR is enabled.
* @see java.net.Socket#getReuseAddress * @see java.net.Socket#getReuseAddress
*/ */
@Override
public final boolean getReuseAddress() throws SocketException { public final boolean getReuseAddress() throws SocketException {
if (self == this) { if (self == this) {
return super.getReuseAddress(); return super.getReuseAddress();
...@@ -538,6 +572,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket { ...@@ -538,6 +572,7 @@ abstract class BaseSSLSocketImpl extends SSLSocket {
* *
* @see java.net.Socket#setPerformancePreferences(int, int, int) * @see java.net.Socket#setPerformancePreferences(int, int, int)
*/ */
@Override
public void setPerformancePreferences(int connectionTime, public void setPerformancePreferences(int connectionTime,
int latency, int bandwidth) { int latency, int bandwidth) {
if (self == this) { if (self == this) {
......
...@@ -50,6 +50,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -50,6 +50,7 @@ class ByteBufferInputStream extends InputStream {
* *
* Increments position(). * Increments position().
*/ */
@Override
public int read() throws IOException { public int read() throws IOException {
if (bb == null) { if (bb == null) {
...@@ -67,6 +68,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -67,6 +68,7 @@ class ByteBufferInputStream extends InputStream {
* *
* Increments position(). * Increments position().
*/ */
@Override
public int read(byte b[]) throws IOException { public int read(byte b[]) throws IOException {
if (bb == null) { if (bb == null) {
...@@ -81,6 +83,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -81,6 +83,7 @@ class ByteBufferInputStream extends InputStream {
* *
* Increments position(). * Increments position().
*/ */
@Override
public int read(byte b[], int off, int len) throws IOException { public int read(byte b[], int off, int len) throws IOException {
if (bb == null) { if (bb == null) {
...@@ -108,6 +111,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -108,6 +111,7 @@ class ByteBufferInputStream extends InputStream {
* Skips over and discards <code>n</code> bytes of data from this input * Skips over and discards <code>n</code> bytes of data from this input
* stream. * stream.
*/ */
@Override
public long skip(long n) throws IOException { public long skip(long n) throws IOException {
if (bb == null) { if (bb == null) {
...@@ -135,6 +139,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -135,6 +139,7 @@ class ByteBufferInputStream extends InputStream {
* from this input stream without blocking by the next caller of a * from this input stream without blocking by the next caller of a
* method for this input stream. * method for this input stream.
*/ */
@Override
public int available() throws IOException { public int available() throws IOException {
if (bb == null) { if (bb == null) {
...@@ -150,6 +155,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -150,6 +155,7 @@ class ByteBufferInputStream extends InputStream {
* *
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
bb = null; bb = null;
} }
...@@ -157,12 +163,14 @@ class ByteBufferInputStream extends InputStream { ...@@ -157,12 +163,14 @@ class ByteBufferInputStream extends InputStream {
/** /**
* Marks the current position in this input stream. * Marks the current position in this input stream.
*/ */
@Override
public synchronized void mark(int readlimit) {} public synchronized void mark(int readlimit) {}
/** /**
* Repositions this stream to the position at the time the * Repositions this stream to the position at the time the
* <code>mark</code> method was last called on this input stream. * <code>mark</code> method was last called on this input stream.
*/ */
@Override
public synchronized void reset() throws IOException { public synchronized void reset() throws IOException {
throw new IOException("mark/reset not supported"); throw new IOException("mark/reset not supported");
} }
...@@ -171,6 +179,7 @@ class ByteBufferInputStream extends InputStream { ...@@ -171,6 +179,7 @@ class ByteBufferInputStream extends InputStream {
* Tests if this input stream supports the <code>mark</code> and * Tests if this input stream supports the <code>mark</code> and
* <code>reset</code> methods. * <code>reset</code> methods.
*/ */
@Override
public boolean markSupported() { public boolean markSupported() {
return false; return false;
} }
......
...@@ -32,7 +32,6 @@ import java.util.Hashtable; ...@@ -32,7 +32,6 @@ import java.util.Hashtable;
import java.security.*; import java.security.*;
import javax.crypto.*; import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import java.nio.*; import java.nio.*;
......
...@@ -37,7 +37,6 @@ import javax.crypto.SecretKey; ...@@ -37,7 +37,6 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.KeyExchange.*; import static sun.security.ssl.CipherSuite.KeyExchange.*;
import static sun.security.ssl.CipherSuite.PRF.*; import static sun.security.ssl.CipherSuite.PRF.*;
import static sun.security.ssl.JsseJce.*; import static sun.security.ssl.JsseJce.*;
...@@ -203,6 +202,7 @@ final class CipherSuite implements Comparable<CipherSuite> { ...@@ -203,6 +202,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
* Note that for unsupported CipherSuites parsed from a handshake * Note that for unsupported CipherSuites parsed from a handshake
* message we violate the equals() contract. * message we violate the equals() contract.
*/ */
@Override
public int compareTo(CipherSuite o) { public int compareTo(CipherSuite o) {
return o.priority - priority; return o.priority - priority;
} }
...@@ -210,6 +210,7 @@ final class CipherSuite implements Comparable<CipherSuite> { ...@@ -210,6 +210,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
/** /**
* Returns this.name. * Returns this.name.
*/ */
@Override
public String toString() { public String toString() {
return name; return name;
} }
...@@ -378,6 +379,7 @@ final class CipherSuite implements Comparable<CipherSuite> { ...@@ -378,6 +379,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
} }
} }
@Override
public String toString() { public String toString() {
return name; return name;
} }
...@@ -527,6 +529,7 @@ final class CipherSuite implements Comparable<CipherSuite> { ...@@ -527,6 +529,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
return b.booleanValue(); return b.booleanValue();
} }
@Override
public String toString() { public String toString() {
return description; return description;
} }
...@@ -562,6 +565,7 @@ final class CipherSuite implements Comparable<CipherSuite> { ...@@ -562,6 +565,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
return new MAC(this, protocolVersion, secret); return new MAC(this, protocolVersion, secret);
} }
@Override
public String toString() { public String toString() {
return name; return name;
} }
......
...@@ -177,6 +177,7 @@ final class CipherSuiteList { ...@@ -177,6 +177,7 @@ final class CipherSuiteList {
return suiteNames.clone(); return suiteNames.clone();
} }
@Override
public String toString() { public String toString() {
return cipherSuites.toString(); return cipherSuites.toString();
} }
......
...@@ -45,7 +45,6 @@ import javax.net.ssl.*; ...@@ -45,7 +45,6 @@ import javax.net.ssl.*;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import sun.security.ssl.HandshakeMessage.*; import sun.security.ssl.HandshakeMessage.*;
import sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.KeyExchange.*; import static sun.security.ssl.CipherSuite.KeyExchange.*;
/** /**
...@@ -128,6 +127,7 @@ final class ClientHandshaker extends Handshaker { ...@@ -128,6 +127,7 @@ final class ClientHandshaker extends Handshaker {
* is processed, and writes responses as needed using the connection * is processed, and writes responses as needed using the connection
* in the constructor. * in the constructor.
*/ */
@Override
void processMessage(byte type, int messageLen) throws IOException { void processMessage(byte type, int messageLen) throws IOException {
if (state > type if (state > type
&& (type != HandshakeMessage.ht_hello_request && (type != HandshakeMessage.ht_hello_request
...@@ -505,6 +505,7 @@ final class ClientHandshaker extends Handshaker { ...@@ -505,6 +505,7 @@ final class ClientHandshaker extends Handshaker {
try { try {
subject = AccessController.doPrivileged( subject = AccessController.doPrivileged(
new PrivilegedExceptionAction<Subject>() { new PrivilegedExceptionAction<Subject>() {
@Override
public Subject run() throws Exception { public Subject run() throws Exception {
return Krb5Helper.getClientSubject(getAccSE()); return Krb5Helper.getClientSubject(getAccSE());
}}); }});
...@@ -1104,6 +1105,7 @@ final class ClientHandshaker extends Handshaker { ...@@ -1104,6 +1105,7 @@ final class ClientHandshaker extends Handshaker {
/* /*
* Returns a ClientHello message to kickstart renegotiations * Returns a ClientHello message to kickstart renegotiations
*/ */
@Override
HandshakeMessage getKickstartMessage() throws SSLException { HandshakeMessage getKickstartMessage() throws SSLException {
// session ID of the ClientHello message // session ID of the ClientHello message
SessionId sessionId = SSLSessionImpl.nullSession.getSessionId(); SessionId sessionId = SSLSessionImpl.nullSession.getSessionId();
...@@ -1279,6 +1281,7 @@ final class ClientHandshaker extends Handshaker { ...@@ -1279,6 +1281,7 @@ final class ClientHandshaker extends Handshaker {
/* /*
* Fault detected during handshake. * Fault detected during handshake.
*/ */
@Override
void handshakeAlert(byte description) throws SSLProtocolException { void handshakeAlert(byte description) throws SSLProtocolException {
String message = Alerts.alertDescription(description); String message = Alerts.alertDescription(description);
......
...@@ -39,6 +39,7 @@ import java.math.BigInteger; ...@@ -39,6 +39,7 @@ import java.math.BigInteger;
*/ */
final class DHClientKeyExchange extends HandshakeMessage { final class DHClientKeyExchange extends HandshakeMessage {
@Override
int messageType() { int messageType() {
return ht_client_key_exchange; return ht_client_key_exchange;
} }
...@@ -75,6 +76,7 @@ final class DHClientKeyExchange extends HandshakeMessage { ...@@ -75,6 +76,7 @@ final class DHClientKeyExchange extends HandshakeMessage {
dh_Yc = input.getBytes16(); dh_Yc = input.getBytes16();
} }
@Override
int messageLength() { int messageLength() {
if (dh_Yc == null) { if (dh_Yc == null) {
return 0; return 0;
...@@ -83,10 +85,12 @@ final class DHClientKeyExchange extends HandshakeMessage { ...@@ -83,10 +85,12 @@ final class DHClientKeyExchange extends HandshakeMessage {
} }
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putBytes16(dh_Yc); s.putBytes16(dh_Yc);
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** ClientKeyExchange, DH"); s.println("*** ClientKeyExchange, DH");
......
...@@ -41,6 +41,7 @@ import java.security.spec.*; ...@@ -41,6 +41,7 @@ import java.security.spec.*;
*/ */
final class ECDHClientKeyExchange extends HandshakeMessage { final class ECDHClientKeyExchange extends HandshakeMessage {
@Override
int messageType() { int messageType() {
return ht_client_key_exchange; return ht_client_key_exchange;
} }
...@@ -63,14 +64,17 @@ final class ECDHClientKeyExchange extends HandshakeMessage { ...@@ -63,14 +64,17 @@ final class ECDHClientKeyExchange extends HandshakeMessage {
encodedPoint = input.getBytes8(); encodedPoint = input.getBytes8();
} }
@Override
int messageLength() { int messageLength() {
return encodedPoint.length + 1; return encodedPoint.length + 1;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putBytes8(encodedPoint); s.putBytes8(encodedPoint);
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** ECDHClientKeyExchange"); s.println("*** ECDHClientKeyExchange");
......
...@@ -31,7 +31,6 @@ import java.security.spec.*; ...@@ -31,7 +31,6 @@ import java.security.spec.*;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.crypto.KeyAgreement; import javax.crypto.KeyAgreement;
import javax.crypto.spec.*;
/** /**
* Helper class for the ECDH key exchange. It generates the appropriate * Helper class for the ECDH key exchange. It generates the appropriate
......
...@@ -64,6 +64,7 @@ final class EngineInputRecord extends InputRecord { ...@@ -64,6 +64,7 @@ final class EngineInputRecord extends InputRecord {
this.engine = engine; this.engine = engine;
} }
@Override
byte contentType() { byte contentType() {
if (internalData) { if (internalData) {
return super.contentType(); return super.contentType();
...@@ -271,6 +272,7 @@ final class EngineInputRecord extends InputRecord { ...@@ -271,6 +272,7 @@ final class EngineInputRecord extends InputRecord {
* data to be generated/output before the exception is ever * data to be generated/output before the exception is ever
* generated. * generated.
*/ */
@Override
void writeBuffer(OutputStream s, byte [] buf, int off, int len) void writeBuffer(OutputStream s, byte [] buf, int off, int len)
throws IOException { throws IOException {
/* /*
......
...@@ -29,9 +29,6 @@ package sun.security.ssl; ...@@ -29,9 +29,6 @@ package sun.security.ssl;
import java.io.*; import java.io.*;
import java.nio.*; import java.nio.*;
import javax.net.ssl.SSLException;
import sun.misc.HexDumpEncoder;
/** /**
* A OutputRecord class extension which uses external ByteBuffers * A OutputRecord class extension which uses external ByteBuffers
...@@ -95,6 +92,7 @@ final class EngineOutputRecord extends OutputRecord { ...@@ -95,6 +92,7 @@ final class EngineOutputRecord extends OutputRecord {
finishedMsg = true; finishedMsg = true;
} }
@Override
public void flush() throws IOException { public void flush() throws IOException {
finishedMsg = false; finishedMsg = false;
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package sun.security.ssl; package sun.security.ssl;
import javax.net.ssl.*;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.LinkedList; import java.util.LinkedList;
......
...@@ -38,6 +38,7 @@ final class ExtensionType { ...@@ -38,6 +38,7 @@ final class ExtensionType {
this.name = name; this.name = name;
} }
@Override
public String toString() { public String toString() {
return name; return name;
} }
......
...@@ -28,9 +28,6 @@ package sun.security.ssl; ...@@ -28,9 +28,6 @@ package sun.security.ssl;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.security.*; import java.security.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
...@@ -391,11 +388,13 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -391,11 +388,13 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
// } // }
} }
@Override
protected int engineGetDigestLength() { protected int engineGetDigestLength() {
checkState(); checkState();
return digests[0].getDigestLength(); return digests[0].getDigestLength();
} }
@Override
protected void engineUpdate(byte b) { protected void engineUpdate(byte b) {
checkState(); checkState();
for (int i = 0; (i < digests.length) && (digests[i] != null); i++) { for (int i = 0; (i < digests.length) && (digests[i] != null); i++) {
...@@ -403,6 +402,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -403,6 +402,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
} }
} }
@Override
protected void engineUpdate(byte[] b, int offset, int len) { protected void engineUpdate(byte[] b, int offset, int len) {
checkState(); checkState();
for (int i = 0; (i < digests.length) && (digests[i] != null); i++) { for (int i = 0; (i < digests.length) && (digests[i] != null); i++) {
...@@ -410,6 +410,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -410,6 +410,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
} }
} }
@Override
protected byte[] engineDigest() { protected byte[] engineDigest() {
checkState(); checkState();
byte[] digest = digests[0].digest(); byte[] digest = digests[0].digest();
...@@ -417,6 +418,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -417,6 +418,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
return digest; return digest;
} }
@Override
protected int engineDigest(byte[] buf, int offset, int len) protected int engineDigest(byte[] buf, int offset, int len)
throws DigestException { throws DigestException {
checkState(); checkState();
...@@ -436,6 +438,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -436,6 +438,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
} }
} }
@Override
protected void engineReset() { protected void engineReset() {
checkState(); checkState();
for (int i = 0; (i < digests.length) && (digests[i] != null); i++) { for (int i = 0; (i < digests.length) && (digests[i] != null); i++) {
...@@ -443,6 +446,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable { ...@@ -443,6 +446,7 @@ final class CloneableDigest extends MessageDigest implements Cloneable {
} }
} }
@Override
public Object clone() { public Object clone() {
checkState(); checkState();
for (int i = digests.length - 1; i >= 0; i--) { for (int i = digests.length - 1; i >= 0; i--) {
......
...@@ -28,7 +28,6 @@ package sun.security.ssl; ...@@ -28,7 +28,6 @@ package sun.security.ssl;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.security.MessageDigest;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
...@@ -74,6 +73,7 @@ public class HandshakeInStream extends InputStream { ...@@ -74,6 +73,7 @@ public class HandshakeInStream extends InputStream {
* Note that this returns the bytes remaining in the buffer, not * Note that this returns the bytes remaining in the buffer, not
* the bytes remaining in the current handshake message. * the bytes remaining in the current handshake message.
*/ */
@Override
public int available() { public int available() {
return r.available(); return r.available();
} }
...@@ -81,6 +81,7 @@ public class HandshakeInStream extends InputStream { ...@@ -81,6 +81,7 @@ public class HandshakeInStream extends InputStream {
/* /*
* Get a byte of handshake data. * Get a byte of handshake data.
*/ */
@Override
public int read() throws IOException { public int read() throws IOException {
int n = r.read(); int n = r.read();
if (n == -1) { if (n == -1) {
...@@ -92,6 +93,7 @@ public class HandshakeInStream extends InputStream { ...@@ -92,6 +93,7 @@ public class HandshakeInStream extends InputStream {
/* /*
* Get a bunch of bytes of handshake data. * Get a bunch of bytes of handshake data.
*/ */
@Override
public int read(byte b [], int off, int len) throws IOException { public int read(byte b [], int off, int len) throws IOException {
// we read from a ByteArrayInputStream, it always returns the // we read from a ByteArrayInputStream, it always returns the
// data in a single read if enough is available // data in a single read if enough is available
...@@ -105,6 +107,7 @@ public class HandshakeInStream extends InputStream { ...@@ -105,6 +107,7 @@ public class HandshakeInStream extends InputStream {
/* /*
* Skip some handshake data. * Skip some handshake data.
*/ */
@Override
public long skip(long n) throws IOException { public long skip(long n) throws IOException {
return r.skip(n); return r.skip(n);
} }
...@@ -117,6 +120,7 @@ public class HandshakeInStream extends InputStream { ...@@ -117,6 +120,7 @@ public class HandshakeInStream extends InputStream {
* read, data that has already been consumed is lost even if marked). * read, data that has already been consumed is lost even if marked).
*/ */
@Override
public void mark(int readlimit) { public void mark(int readlimit) {
r.mark(readlimit); r.mark(readlimit);
} }
...@@ -126,6 +130,7 @@ public class HandshakeInStream extends InputStream { ...@@ -126,6 +130,7 @@ public class HandshakeInStream extends InputStream {
r.reset(); r.reset();
} }
@Override
public boolean markSupported() { public boolean markSupported() {
return true; return true;
} }
......
...@@ -170,6 +170,7 @@ public abstract class HandshakeMessage { ...@@ -170,6 +170,7 @@ public abstract class HandshakeMessage {
* session parameters after a connection has been (re)established. * session parameters after a connection has been (re)established.
*/ */
static final class HelloRequest extends HandshakeMessage { static final class HelloRequest extends HandshakeMessage {
@Override
int messageType() { return ht_hello_request; } int messageType() { return ht_hello_request; }
HelloRequest() { } HelloRequest() { }
...@@ -179,13 +180,16 @@ static final class HelloRequest extends HandshakeMessage { ...@@ -179,13 +180,16 @@ static final class HelloRequest extends HandshakeMessage {
// nothing in this message // nothing in this message
} }
@Override
int messageLength() { return 0; } int messageLength() { return 0; }
@Override
void send(HandshakeOutStream out) throws IOException void send(HandshakeOutStream out) throws IOException
{ {
// nothing in this messaage // nothing in this messaage
} }
@Override
void print(PrintStream out) throws IOException void print(PrintStream out) throws IOException
{ {
out.println("*** HelloRequest (empty)"); out.println("*** HelloRequest (empty)");
...@@ -329,6 +333,7 @@ static final class ClientHello extends HandshakeMessage { ...@@ -329,6 +333,7 @@ static final class ClientHello extends HandshakeMessage {
static final static final
class ServerHello extends HandshakeMessage class ServerHello extends HandshakeMessage
{ {
@Override
int messageType() { return ht_server_hello; } int messageType() { return ht_server_hello; }
ProtocolVersion protocolVersion; ProtocolVersion protocolVersion;
...@@ -355,6 +360,7 @@ class ServerHello extends HandshakeMessage ...@@ -355,6 +360,7 @@ class ServerHello extends HandshakeMessage
} }
} }
@Override
int messageLength() int messageLength()
{ {
// almost fixed size, except session ID and extensions: // almost fixed size, except session ID and extensions:
...@@ -366,6 +372,7 @@ class ServerHello extends HandshakeMessage ...@@ -366,6 +372,7 @@ class ServerHello extends HandshakeMessage
return 38 + sessionId.length() + extensions.length(); return 38 + sessionId.length() + extensions.length();
} }
@Override
void send(HandshakeOutStream s) throws IOException void send(HandshakeOutStream s) throws IOException
{ {
s.putInt8(protocolVersion.major); s.putInt8(protocolVersion.major);
...@@ -378,6 +385,7 @@ class ServerHello extends HandshakeMessage ...@@ -378,6 +385,7 @@ class ServerHello extends HandshakeMessage
extensions.send(s); extensions.send(s);
} }
@Override
void print(PrintStream s) throws IOException void print(PrintStream s) throws IOException
{ {
s.println("*** ServerHello, " + protocolVersion); s.println("*** ServerHello, " + protocolVersion);
...@@ -416,6 +424,7 @@ class ServerHello extends HandshakeMessage ...@@ -416,6 +424,7 @@ class ServerHello extends HandshakeMessage
static final static final
class CertificateMsg extends HandshakeMessage class CertificateMsg extends HandshakeMessage
{ {
@Override
int messageType() { return ht_certificate; } int messageType() { return ht_certificate; }
private X509Certificate[] chain; private X509Certificate[] chain;
...@@ -450,6 +459,7 @@ class CertificateMsg extends HandshakeMessage ...@@ -450,6 +459,7 @@ class CertificateMsg extends HandshakeMessage
chain = v.toArray(new X509Certificate[v.size()]); chain = v.toArray(new X509Certificate[v.size()]);
} }
@Override
int messageLength() { int messageLength() {
if (encodedChain == null) { if (encodedChain == null) {
messageLength = 3; messageLength = 3;
...@@ -468,6 +478,7 @@ class CertificateMsg extends HandshakeMessage ...@@ -468,6 +478,7 @@ class CertificateMsg extends HandshakeMessage
return messageLength; return messageLength;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt24(messageLength() - 3); s.putInt24(messageLength() - 3);
for (byte[] b : encodedChain) { for (byte[] b : encodedChain) {
...@@ -475,6 +486,7 @@ class CertificateMsg extends HandshakeMessage ...@@ -475,6 +486,7 @@ class CertificateMsg extends HandshakeMessage
} }
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** Certificate chain"); s.println("*** Certificate chain");
...@@ -528,6 +540,7 @@ class CertificateMsg extends HandshakeMessage ...@@ -528,6 +540,7 @@ class CertificateMsg extends HandshakeMessage
*/ */
static abstract class ServerKeyExchange extends HandshakeMessage static abstract class ServerKeyExchange extends HandshakeMessage
{ {
@Override
int messageType() { return ht_server_key_exchange; } int messageType() { return ht_server_key_exchange; }
} }
...@@ -635,17 +648,20 @@ class RSA_ServerKeyExchange extends ServerKeyExchange ...@@ -635,17 +648,20 @@ class RSA_ServerKeyExchange extends ServerKeyExchange
return signature.verify(signatureBytes); return signature.verify(signatureBytes);
} }
@Override
int messageLength() { int messageLength() {
return 6 + rsa_modulus.length + rsa_exponent.length return 6 + rsa_modulus.length + rsa_exponent.length
+ signatureBytes.length; + signatureBytes.length;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putBytes16(rsa_modulus); s.putBytes16(rsa_modulus);
s.putBytes16(rsa_exponent); s.putBytes16(rsa_exponent);
s.putBytes16(signatureBytes); s.putBytes16(signatureBytes);
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** RSA ServerKeyExchange"); s.println("*** RSA ServerKeyExchange");
...@@ -874,6 +890,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange ...@@ -874,6 +890,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange
dh_Ys = toByteArray(obj.getPublicKey()); dh_Ys = toByteArray(obj.getPublicKey());
} }
@Override
int messageLength() { int messageLength() {
int temp = 6; // overhead for p, g, y(s) values. int temp = 6; // overhead for p, g, y(s) values.
...@@ -895,6 +912,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange ...@@ -895,6 +912,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange
return temp; return temp;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putBytes16(dh_p); s.putBytes16(dh_p);
s.putBytes16(dh_g); s.putBytes16(dh_g);
...@@ -914,6 +932,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange ...@@ -914,6 +932,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange
} }
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** Diffie-Hellman ServerKeyExchange"); s.println("*** Diffie-Hellman ServerKeyExchange");
...@@ -1118,6 +1137,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { ...@@ -1118,6 +1137,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
sig.update(pointBytes); sig.update(pointBytes);
} }
@Override
int messageLength() { int messageLength() {
int sigLen = 0; int sigLen = 0;
if (signatureBytes != null) { if (signatureBytes != null) {
...@@ -1130,6 +1150,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { ...@@ -1130,6 +1150,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
return 4 + pointBytes.length + sigLen; return 4 + pointBytes.length + sigLen;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt8(CURVE_NAMED_CURVE); s.putInt8(CURVE_NAMED_CURVE);
s.putInt16(curveId); s.putInt16(curveId);
...@@ -1145,6 +1166,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { ...@@ -1145,6 +1166,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
} }
} }
@Override
void print(PrintStream s) throws IOException { void print(PrintStream s) throws IOException {
s.println("*** ECDH ServerKeyExchange"); s.println("*** ECDH ServerKeyExchange");
...@@ -1479,6 +1501,7 @@ class CertificateRequest extends HandshakeMessage ...@@ -1479,6 +1501,7 @@ class CertificateRequest extends HandshakeMessage
static final static final
class ServerHelloDone extends HandshakeMessage class ServerHelloDone extends HandshakeMessage
{ {
@Override
int messageType() { return ht_server_hello_done; } int messageType() { return ht_server_hello_done; }
ServerHelloDone() { } ServerHelloDone() { }
...@@ -1488,16 +1511,19 @@ class ServerHelloDone extends HandshakeMessage ...@@ -1488,16 +1511,19 @@ class ServerHelloDone extends HandshakeMessage
// nothing to do // nothing to do
} }
@Override
int messageLength() int messageLength()
{ {
return 0; return 0;
} }
@Override
void send(HandshakeOutStream s) throws IOException void send(HandshakeOutStream s) throws IOException
{ {
// nothing to send // nothing to send
} }
@Override
void print(PrintStream s) throws IOException void print(PrintStream s) throws IOException
{ {
s.println("*** ServerHelloDone"); s.println("*** ServerHelloDone");
...@@ -1712,6 +1738,7 @@ static final class CertificateVerify extends HandshakeMessage { ...@@ -1712,6 +1738,7 @@ static final class CertificateVerify extends HandshakeMessage {
private static void makeAccessible(final AccessibleObject o) { private static void makeAccessible(final AccessibleObject o) {
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
o.setAccessible(true); o.setAccessible(true);
return null; return null;
......
...@@ -28,7 +28,6 @@ package sun.security.ssl; ...@@ -28,7 +28,6 @@ package sun.security.ssl;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.IOException; import java.io.IOException;
import java.security.MessageDigest;
/** /**
* Output stream for handshake data. This is used only internally * Output stream for handshake data. This is used only internally
...@@ -87,6 +86,7 @@ public class HandshakeOutStream extends OutputStream { ...@@ -87,6 +86,7 @@ public class HandshakeOutStream extends OutputStream {
* Hashes are updated automatically if something gets flushed to the * Hashes are updated automatically if something gets flushed to the
* network (e.g. a big cert message etc). * network (e.g. a big cert message etc).
*/ */
@Override
public void write(byte buf[], int off, int len) throws IOException { public void write(byte buf[], int off, int len) throws IOException {
while (len > 0) { while (len > 0) {
int howmuch = Math.min(len, r.availableDataBytes()); int howmuch = Math.min(len, r.availableDataBytes());
...@@ -104,6 +104,7 @@ public class HandshakeOutStream extends OutputStream { ...@@ -104,6 +104,7 @@ public class HandshakeOutStream extends OutputStream {
/* /*
* write-a-byte * write-a-byte
*/ */
@Override
public void write(int i) throws IOException { public void write(int i) throws IOException {
if (r.availableDataBytes() < 1) { if (r.availableDataBytes() < 1) {
flush(); flush();
...@@ -111,6 +112,7 @@ public class HandshakeOutStream extends OutputStream { ...@@ -111,6 +112,7 @@ public class HandshakeOutStream extends OutputStream {
r.write(i); r.write(i);
} }
@Override
public void flush() throws IOException { public void flush() throws IOException {
if (socket != null) { if (socket != null) {
try { try {
......
...@@ -820,6 +820,7 @@ abstract class Handshaker { ...@@ -820,6 +820,7 @@ abstract class Handshaker {
processLoop(); processLoop();
} else { } else {
delegateTask(new PrivilegedExceptionAction<Void>() { delegateTask(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception { public Void run() throws Exception {
processLoop(); processLoop();
return null; return null;
......
...@@ -40,6 +40,7 @@ abstract class HelloExtension { ...@@ -40,6 +40,7 @@ abstract class HelloExtension {
abstract void send(HandshakeOutStream s) throws IOException; abstract void send(HandshakeOutStream s) throws IOException;
@Override
public abstract String toString(); public abstract String toString();
} }
...@@ -29,8 +29,6 @@ import java.io.IOException; ...@@ -29,8 +29,6 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.*; import java.util.*;
import javax.net.ssl.*; import javax.net.ssl.*;
import java.nio.charset.StandardCharsets;
import java.security.spec.ECParameterSpec;
/** /**
* This file contains all the classes relevant to TLS Extensions for the * This file contains all the classes relevant to TLS Extensions for the
......
...@@ -28,8 +28,6 @@ package sun.security.ssl; ...@@ -28,8 +28,6 @@ package sun.security.ssl;
import java.io.*; import java.io.*;
import java.nio.*; import java.nio.*;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
...@@ -285,6 +283,7 @@ class InputRecord extends ByteArrayInputStream implements Record { ...@@ -285,6 +283,7 @@ class InputRecord extends ByteArrayInputStream implements Record {
* Prevent any more data from being read into this record, * Prevent any more data from being read into this record,
* and flag the record as holding no data. * and flag the record as holding no data.
*/ */
@Override
public void close() { public void close() {
appDataValid = false; appDataValid = false;
isClosed = true; isClosed = true;
......
...@@ -71,6 +71,7 @@ final class JsseJce { ...@@ -71,6 +71,7 @@ final class JsseJce {
try { try {
AccessController.doPrivileged( AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>() { new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception { public Void run() throws Exception {
// Test for Kerberos using the bootstrap class loader // Test for Kerberos using the bootstrap class loader
Class.forName("sun.security.krb5.PrincipalName", true, Class.forName("sun.security.krb5.PrincipalName", true,
...@@ -114,6 +115,7 @@ final class JsseJce { ...@@ -114,6 +115,7 @@ final class JsseJce {
SunCertificates(final Provider p) { SunCertificates(final Provider p) {
super("SunCertificates", 1.0d, "SunJSSE internal"); super("SunCertificates", 1.0d, "SunJSSE internal");
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
// copy certificate related services from the Sun provider // copy certificate related services from the Sun provider
for (Map.Entry<Object,Object> entry : p.entrySet()) { for (Map.Entry<Object,Object> entry : p.entrySet()) {
......
...@@ -44,6 +44,7 @@ public class KerberosClientKeyExchange extends HandshakeMessage { ...@@ -44,6 +44,7 @@ public class KerberosClientKeyExchange extends HandshakeMessage {
private static final Class<?> implClass = AccessController.doPrivileged( private static final Class<?> implClass = AccessController.doPrivileged(
new PrivilegedAction<Class<?>>() { new PrivilegedAction<Class<?>>() {
@Override
public Class<?> run() { public Class<?> run() {
try { try {
return Class.forName(IMPL_CLASS, true, null); return Class.forName(IMPL_CLASS, true, null);
......
...@@ -45,6 +45,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi { ...@@ -45,6 +45,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
/** /**
* Returns one key manager for each type of key material. * Returns one key manager for each type of key material.
*/ */
@Override
protected KeyManager[] engineGetKeyManagers() { protected KeyManager[] engineGetKeyManagers() {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException( throw new IllegalStateException(
...@@ -56,6 +57,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi { ...@@ -56,6 +57,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
// Factory for the SunX509 keymanager // Factory for the SunX509 keymanager
public static final class SunX509 extends KeyManagerFactoryImpl { public static final class SunX509 extends KeyManagerFactoryImpl {
@Override
protected void engineInit(KeyStore ks, char[] password) throws protected void engineInit(KeyStore ks, char[] password) throws
KeyStoreException, NoSuchAlgorithmException, KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException { UnrecoverableKeyException {
...@@ -69,6 +71,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi { ...@@ -69,6 +71,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
isInitialized = true; isInitialized = true;
} }
@Override
protected void engineInit(ManagerFactoryParameters spec) throws protected void engineInit(ManagerFactoryParameters spec) throws
InvalidAlgorithmParameterException { InvalidAlgorithmParameterException {
throw new InvalidAlgorithmParameterException( throw new InvalidAlgorithmParameterException(
...@@ -80,6 +83,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi { ...@@ -80,6 +83,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
// Factory for the X509 keymanager // Factory for the X509 keymanager
public static final class X509 extends KeyManagerFactoryImpl { public static final class X509 extends KeyManagerFactoryImpl {
@Override
protected void engineInit(KeyStore ks, char[] password) throws protected void engineInit(KeyStore ks, char[] password) throws
KeyStoreException, NoSuchAlgorithmException, KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException { UnrecoverableKeyException {
...@@ -102,6 +106,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi { ...@@ -102,6 +106,7 @@ abstract class KeyManagerFactoryImpl extends KeyManagerFactorySpi {
isInitialized = true; isInitialized = true;
} }
@Override
protected void engineInit(ManagerFactoryParameters params) throws protected void engineInit(ManagerFactoryParameters params) throws
InvalidAlgorithmParameterException { InvalidAlgorithmParameterException {
if (params instanceof KeyStoreBuilderParameters == false) { if (params instanceof KeyStoreBuilderParameters == false) {
......
...@@ -47,6 +47,7 @@ public final class Krb5Helper { ...@@ -47,6 +47,7 @@ public final class Krb5Helper {
private static final Krb5Proxy proxy = private static final Krb5Proxy proxy =
AccessController.doPrivileged(new PrivilegedAction<Krb5Proxy>() { AccessController.doPrivileged(new PrivilegedAction<Krb5Proxy>() {
@Override
public Krb5Proxy run() { public Krb5Proxy run() {
try { try {
Class<?> c = Class.forName(IMPL_CLASS, true, null); Class<?> c = Class.forName(IMPL_CLASS, true, null);
......
...@@ -116,6 +116,7 @@ class OutputRecord extends ByteArrayOutputStream implements Record { ...@@ -116,6 +116,7 @@ class OutputRecord extends ByteArrayOutputStream implements Record {
* Reset the record so that it can be refilled, starting * Reset the record so that it can be refilled, starting
* immediately after the header. * immediately after the header.
*/ */
@Override
public synchronized void reset() { public synchronized void reset() {
super.reset(); super.reset();
count = headerSize; count = headerSize;
......
...@@ -147,6 +147,7 @@ final class ProtocolList { ...@@ -147,6 +147,7 @@ final class ProtocolList {
return protocolNames.clone(); return protocolNames.clone();
} }
@Override
public String toString() { public String toString() {
return protocols.toString(); return protocols.toString();
} }
......
...@@ -165,6 +165,7 @@ public final class ProtocolVersion implements Comparable<ProtocolVersion> { ...@@ -165,6 +165,7 @@ public final class ProtocolVersion implements Comparable<ProtocolVersion> {
} }
} }
@Override
public String toString() { public String toString() {
return name; return name;
} }
...@@ -172,6 +173,7 @@ public final class ProtocolVersion implements Comparable<ProtocolVersion> { ...@@ -172,6 +173,7 @@ public final class ProtocolVersion implements Comparable<ProtocolVersion> {
/** /**
* Compares this object with the specified object for order. * Compares this object with the specified object for order.
*/ */
@Override
public int compareTo(ProtocolVersion protocolVersion) { public int compareTo(ProtocolVersion protocolVersion) {
return this.v - protocolVersion.v; return this.v - protocolVersion.v;
} }
......
...@@ -28,10 +28,8 @@ package sun.security.ssl; ...@@ -28,10 +28,8 @@ package sun.security.ssl;
import java.io.*; import java.io.*;
import java.security.*; import java.security.*;
import java.security.interfaces.*;
import javax.crypto.*; import javax.crypto.*;
import javax.crypto.spec.*;
import javax.net.ssl.*; import javax.net.ssl.*;
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
package sun.security.ssl; package sun.security.ssl;
import java.util.Arrays;
import java.security.*; import java.security.*;
/** /**
...@@ -106,6 +104,7 @@ public final class RSASignature extends SignatureSpi { ...@@ -106,6 +104,7 @@ public final class RSASignature extends SignatureSpi {
} }
} }
@Override
protected void engineInitVerify(PublicKey publicKey) protected void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException { throws InvalidKeyException {
checkNull(publicKey); checkNull(publicKey);
...@@ -113,11 +112,13 @@ public final class RSASignature extends SignatureSpi { ...@@ -113,11 +112,13 @@ public final class RSASignature extends SignatureSpi {
rawRsa.initVerify(publicKey); rawRsa.initVerify(publicKey);
} }
@Override
protected void engineInitSign(PrivateKey privateKey) protected void engineInitSign(PrivateKey privateKey)
throws InvalidKeyException { throws InvalidKeyException {
engineInitSign(privateKey, null); engineInitSign(privateKey, null);
} }
@Override
protected void engineInitSign(PrivateKey privateKey, SecureRandom random) protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
throws InvalidKeyException { throws InvalidKeyException {
checkNull(privateKey); checkNull(privateKey);
...@@ -133,6 +134,7 @@ public final class RSASignature extends SignatureSpi { ...@@ -133,6 +134,7 @@ public final class RSASignature extends SignatureSpi {
} }
} }
@Override
protected void engineUpdate(byte b) { protected void engineUpdate(byte b) {
initDigests(); initDigests();
isReset = false; isReset = false;
...@@ -140,6 +142,7 @@ public final class RSASignature extends SignatureSpi { ...@@ -140,6 +142,7 @@ public final class RSASignature extends SignatureSpi {
sha.update(b); sha.update(b);
} }
@Override
protected void engineUpdate(byte[] b, int off, int len) { protected void engineUpdate(byte[] b, int off, int len) {
initDigests(); initDigests();
isReset = false; isReset = false;
...@@ -161,21 +164,25 @@ public final class RSASignature extends SignatureSpi { ...@@ -161,21 +164,25 @@ public final class RSASignature extends SignatureSpi {
} }
} }
@Override
protected byte[] engineSign() throws SignatureException { protected byte[] engineSign() throws SignatureException {
rawRsa.update(getDigest()); rawRsa.update(getDigest());
return rawRsa.sign(); return rawRsa.sign();
} }
@Override
protected boolean engineVerify(byte[] sigBytes) throws SignatureException { protected boolean engineVerify(byte[] sigBytes) throws SignatureException {
return engineVerify(sigBytes, 0, sigBytes.length); return engineVerify(sigBytes, 0, sigBytes.length);
} }
@Override
protected boolean engineVerify(byte[] sigBytes, int offset, int length) protected boolean engineVerify(byte[] sigBytes, int offset, int length)
throws SignatureException { throws SignatureException {
rawRsa.update(getDigest()); rawRsa.update(getDigest());
return rawRsa.verify(sigBytes, offset, length); return rawRsa.verify(sigBytes, offset, length);
} }
@Override
protected void engineSetParameter(String param, Object value) protected void engineSetParameter(String param, Object value)
throws InvalidParameterException { throws InvalidParameterException {
if (param.equals("hashes") == false) { if (param.equals("hashes") == false) {
...@@ -191,6 +198,7 @@ public final class RSASignature extends SignatureSpi { ...@@ -191,6 +198,7 @@ public final class RSASignature extends SignatureSpi {
sha = digests[1]; sha = digests[1];
} }
@Override
protected Object engineGetParameter(String param) protected Object engineGetParameter(String param)
throws InvalidParameterException { throws InvalidParameterException {
throw new InvalidParameterException("Parameters not supported"); throw new InvalidParameterException("Parameters not supported");
......
...@@ -85,10 +85,12 @@ final class RenegotiationInfoExtension extends HelloExtension { ...@@ -85,10 +85,12 @@ final class RenegotiationInfoExtension extends HelloExtension {
// Length of the encoded extension, including the type and length fields // Length of the encoded extension, including the type and length fields
@Override
int length() { int length() {
return 5 + renegotiated_connection.length; return 5 + renegotiated_connection.length;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id); s.putInt16(type.id);
s.putInt16(renegotiated_connection.length + 1); s.putInt16(renegotiated_connection.length + 1);
...@@ -103,6 +105,7 @@ final class RenegotiationInfoExtension extends HelloExtension { ...@@ -103,6 +105,7 @@ final class RenegotiationInfoExtension extends HelloExtension {
return renegotiated_connection; return renegotiated_connection;
} }
@Override
public String toString() { public String toString() {
return "Extension " + type + ", renegotiated_connection: " + return "Extension " + type + ", renegotiated_connection: " +
(renegotiated_connection.length == 0 ? "<empty>" : (renegotiated_connection.length == 0 ? "<empty>" :
......
...@@ -111,6 +111,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { ...@@ -111,6 +111,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
} }
} }
@Override
public boolean permits(Set<CryptoPrimitive> primitives, public boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) { String algorithm, AlgorithmParameters parameters) {
...@@ -139,6 +140,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { ...@@ -139,6 +140,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
return permitted; return permitted;
} }
@Override
public boolean permits(Set<CryptoPrimitive> primitives, Key key) { public boolean permits(Set<CryptoPrimitive> primitives, Key key) {
boolean permitted = true; boolean permitted = true;
...@@ -162,6 +164,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { ...@@ -162,6 +164,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
return permitted; return permitted;
} }
@Override
public boolean permits(Set<CryptoPrimitive> primitives, public boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) { String algorithm, Key key, AlgorithmParameters parameters) {
...@@ -204,6 +207,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { ...@@ -204,6 +207,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
} }
} }
@Override
public boolean permits(Set<CryptoPrimitive> primitives, public boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) { String algorithm, AlgorithmParameters parameters) {
...@@ -237,10 +241,12 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { ...@@ -237,10 +241,12 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
return false; return false;
} }
@Override
final public boolean permits(Set<CryptoPrimitive> primitives, Key key) { final public boolean permits(Set<CryptoPrimitive> primitives, Key key) {
return true; return true;
} }
@Override
final public boolean permits(Set<CryptoPrimitive> primitives, final public boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) { String algorithm, Key key, AlgorithmParameters parameters) {
......
...@@ -71,6 +71,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -71,6 +71,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
serverCache = new SSLSessionContextImpl(); serverCache = new SSLSessionContextImpl();
} }
@Override
protected void engineInit(KeyManager[] km, TrustManager[] tm, protected void engineInit(KeyManager[] km, TrustManager[] tm,
SecureRandom sr) throws KeyManagementException { SecureRandom sr) throws KeyManagementException {
isInitialized = false; isInitialized = false;
...@@ -177,6 +178,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -177,6 +178,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return DummyX509KeyManager.INSTANCE; return DummyX509KeyManager.INSTANCE;
} }
@Override
protected SSLSocketFactory engineGetSocketFactory() { protected SSLSocketFactory engineGetSocketFactory() {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException( throw new IllegalStateException(
...@@ -185,6 +187,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -185,6 +187,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return new SSLSocketFactoryImpl(this); return new SSLSocketFactoryImpl(this);
} }
@Override
protected SSLServerSocketFactory engineGetServerSocketFactory() { protected SSLServerSocketFactory engineGetServerSocketFactory() {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException("SSLContext is not initialized"); throw new IllegalStateException("SSLContext is not initialized");
...@@ -192,6 +195,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -192,6 +195,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return new SSLServerSocketFactoryImpl(this); return new SSLServerSocketFactoryImpl(this);
} }
@Override
protected SSLEngine engineCreateSSLEngine() { protected SSLEngine engineCreateSSLEngine() {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException( throw new IllegalStateException(
...@@ -200,6 +204,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -200,6 +204,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return new SSLEngineImpl(this); return new SSLEngineImpl(this);
} }
@Override
protected SSLEngine engineCreateSSLEngine(String host, int port) { protected SSLEngine engineCreateSSLEngine(String host, int port) {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException( throw new IllegalStateException(
...@@ -208,10 +213,12 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -208,10 +213,12 @@ public abstract class SSLContextImpl extends SSLContextSpi {
return new SSLEngineImpl(this, host, port); return new SSLEngineImpl(this, host, port);
} }
@Override
protected SSLSessionContext engineGetClientSessionContext() { protected SSLSessionContext engineGetClientSessionContext() {
return clientCache; return clientCache;
} }
@Override
protected SSLSessionContext engineGetServerSessionContext() { protected SSLSessionContext engineGetServerSessionContext() {
return serverCache; return serverCache;
} }
...@@ -463,14 +470,17 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -463,14 +470,17 @@ public abstract class SSLContextImpl extends SSLContextSpi {
} }
} }
@Override
SSLParameters getDefaultServerSSLParams() { SSLParameters getDefaultServerSSLParams() {
return defaultServerSSLParams; return defaultServerSSLParams;
} }
@Override
SSLParameters getDefaultClientSSLParams() { SSLParameters getDefaultClientSSLParams() {
return defaultClientSSLParams; return defaultClientSSLParams;
} }
@Override
SSLParameters getSupportedSSLParams() { SSLParameters getSupportedSSLParams() {
return supportedSSLParams; return supportedSSLParams;
} }
...@@ -506,6 +516,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -506,6 +516,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
} }
} }
@Override
protected void engineInit(KeyManager[] km, TrustManager[] tm, protected void engineInit(KeyManager[] km, TrustManager[] tm,
SecureRandom sr) throws KeyManagementException { SecureRandom sr) throws KeyManagementException {
throw new KeyManagementException throw new KeyManagementException
...@@ -544,6 +555,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -544,6 +555,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
final Map<String,String> props = new HashMap<>(); final Map<String,String> props = new HashMap<>();
AccessController.doPrivileged( AccessController.doPrivileged(
new PrivilegedExceptionAction<Object>() { new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception { public Object run() throws Exception {
props.put("keyStore", System.getProperty( props.put("keyStore", System.getProperty(
"javax.net.ssl.keyStore", "")); "javax.net.ssl.keyStore", ""));
...@@ -583,6 +595,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -583,6 +595,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
!NONE.equals(defaultKeyStore)) { !NONE.equals(defaultKeyStore)) {
fs = AccessController.doPrivileged( fs = AccessController.doPrivileged(
new PrivilegedExceptionAction<FileInputStream>() { new PrivilegedExceptionAction<FileInputStream>() {
@Override
public FileInputStream run() throws Exception { public FileInputStream run() throws Exception {
return new FileInputStream(defaultKeyStore); return new FileInputStream(defaultKeyStore);
} }
...@@ -697,14 +710,17 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -697,14 +710,17 @@ public abstract class SSLContextImpl extends SSLContextSpi {
} }
} }
@Override
SSLParameters getDefaultServerSSLParams() { SSLParameters getDefaultServerSSLParams() {
return defaultServerSSLParams; return defaultServerSSLParams;
} }
@Override
SSLParameters getDefaultClientSSLParams() { SSLParameters getDefaultClientSSLParams() {
return defaultClientSSLParams; return defaultClientSSLParams;
} }
@Override
SSLParameters getSupportedSSLParams() { SSLParameters getSupportedSSLParams() {
return supportedSSLParams; return supportedSSLParams;
} }
...@@ -761,14 +777,17 @@ public abstract class SSLContextImpl extends SSLContextSpi { ...@@ -761,14 +777,17 @@ public abstract class SSLContextImpl extends SSLContextSpi {
} }
} }
@Override
SSLParameters getDefaultServerSSLParams() { SSLParameters getDefaultServerSSLParams() {
return defaultServerSSLParams; return defaultServerSSLParams;
} }
@Override
SSLParameters getDefaultClientSSLParams() { SSLParameters getDefaultClientSSLParams() {
return defaultClientSSLParams; return defaultClientSSLParams;
} }
@Override
SSLParameters getSupportedSSLParams() { SSLParameters getSupportedSSLParams() {
return supportedSSLParams; return supportedSSLParams;
} }
...@@ -1041,28 +1060,34 @@ final class AbstractKeyManagerWrapper extends X509ExtendedKeyManager { ...@@ -1041,28 +1060,34 @@ final class AbstractKeyManagerWrapper extends X509ExtendedKeyManager {
this.km = km; this.km = km;
} }
@Override
public String[] getClientAliases(String keyType, Principal[] issuers) { public String[] getClientAliases(String keyType, Principal[] issuers) {
return km.getClientAliases(keyType, issuers); return km.getClientAliases(keyType, issuers);
} }
@Override
public String chooseClientAlias(String[] keyType, Principal[] issuers, public String chooseClientAlias(String[] keyType, Principal[] issuers,
Socket socket) { Socket socket) {
return km.chooseClientAlias(keyType, issuers, socket); return km.chooseClientAlias(keyType, issuers, socket);
} }
@Override
public String[] getServerAliases(String keyType, Principal[] issuers) { public String[] getServerAliases(String keyType, Principal[] issuers) {
return km.getServerAliases(keyType, issuers); return km.getServerAliases(keyType, issuers);
} }
@Override
public String chooseServerAlias(String keyType, Principal[] issuers, public String chooseServerAlias(String keyType, Principal[] issuers,
Socket socket) { Socket socket) {
return km.chooseServerAlias(keyType, issuers, socket); return km.chooseServerAlias(keyType, issuers, socket);
} }
@Override
public X509Certificate[] getCertificateChain(String alias) { public X509Certificate[] getCertificateChain(String alias) {
return km.getCertificateChain(alias); return km.getCertificateChain(alias);
} }
@Override
public PrivateKey getPrivateKey(String alias) { public PrivateKey getPrivateKey(String alias) {
return km.getPrivateKey(alias); return km.getPrivateKey(alias);
} }
...@@ -1087,6 +1112,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1087,6 +1112,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String[] getClientAliases(String keyType, Principal[] issuers) { public String[] getClientAliases(String keyType, Principal[] issuers) {
return null; return null;
} }
...@@ -1096,6 +1122,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1096,6 +1122,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseClientAlias(String[] keyTypes, Principal[] issuers, public String chooseClientAlias(String[] keyTypes, Principal[] issuers,
Socket socket) { Socket socket) {
return null; return null;
...@@ -1106,6 +1133,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1106,6 +1133,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* engine given the public key type and the list of * engine given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseEngineClientAlias( public String chooseEngineClientAlias(
String[] keyTypes, Principal[] issuers, SSLEngine engine) { String[] keyTypes, Principal[] issuers, SSLEngine engine) {
return null; return null;
...@@ -1116,6 +1144,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1116,6 +1144,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String[] getServerAliases(String keyType, Principal[] issuers) { public String[] getServerAliases(String keyType, Principal[] issuers) {
return null; return null;
} }
...@@ -1125,6 +1154,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1125,6 +1154,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseServerAlias(String keyType, Principal[] issuers, public String chooseServerAlias(String keyType, Principal[] issuers,
Socket socket) { Socket socket) {
return null; return null;
...@@ -1135,6 +1165,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1135,6 +1165,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* given the public key type and the list of * given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseEngineServerAlias( public String chooseEngineServerAlias(
String keyType, Principal[] issuers, SSLEngine engine) { String keyType, Principal[] issuers, SSLEngine engine) {
return null; return null;
...@@ -1148,6 +1179,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1148,6 +1179,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* @return the certificate chain (ordered with the user's certificate first * @return the certificate chain (ordered with the user's certificate first
* and the root certificate authority last) * and the root certificate authority last)
*/ */
@Override
public X509Certificate[] getCertificateChain(String alias) { public X509Certificate[] getCertificateChain(String alias) {
return null; return null;
} }
...@@ -1160,6 +1192,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager { ...@@ -1160,6 +1192,7 @@ final class DummyX509KeyManager extends X509ExtendedKeyManager {
* *
* @return the requested key * @return the requested key
*/ */
@Override
public PrivateKey getPrivateKey(String alias) { public PrivateKey getPrivateKey(String alias) {
return null; return null;
} }
......
...@@ -553,6 +553,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -553,6 +553,7 @@ final public class SSLEngineImpl extends SSLEngine {
/* /*
* Is a handshake currently underway? * Is a handshake currently underway?
*/ */
@Override
public SSLEngineResult.HandshakeStatus getHandshakeStatus() { public SSLEngineResult.HandshakeStatus getHandshakeStatus() {
return getHSStatus(null); return getHSStatus(null);
} }
...@@ -736,6 +737,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -736,6 +737,7 @@ final public class SSLEngineImpl extends SSLEngine {
/* /*
* Start a SSLEngine handshake * Start a SSLEngine handshake
*/ */
@Override
public void beginHandshake() throws SSLException { public void beginHandshake() throws SSLException {
try { try {
kickstartHandshake(); kickstartHandshake();
...@@ -755,6 +757,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -755,6 +757,7 @@ final public class SSLEngineImpl extends SSLEngine {
* Unwraps a buffer. Does a variety of checks before grabbing * Unwraps a buffer. Does a variety of checks before grabbing
* the unwrapLock, which blocks multiple unwraps from occuring. * the unwrapLock, which blocks multiple unwraps from occuring.
*/ */
@Override
public SSLEngineResult unwrap(ByteBuffer netData, ByteBuffer [] appData, public SSLEngineResult unwrap(ByteBuffer netData, ByteBuffer [] appData,
int offset, int length) throws SSLException { int offset, int length) throws SSLException {
...@@ -1155,6 +1158,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1155,6 +1158,7 @@ final public class SSLEngineImpl extends SSLEngine {
* Wraps a buffer. Does a variety of checks before grabbing * Wraps a buffer. Does a variety of checks before grabbing
* the wrapLock, which blocks multiple wraps from occuring. * the wrapLock, which blocks multiple wraps from occuring.
*/ */
@Override
public SSLEngineResult wrap(ByteBuffer [] appData, public SSLEngineResult wrap(ByteBuffer [] appData,
int offset, int length, ByteBuffer netData) throws SSLException { int offset, int length, ByteBuffer netData) throws SSLException {
...@@ -1476,6 +1480,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1476,6 +1480,7 @@ final public class SSLEngineImpl extends SSLEngine {
connectionState = cs_CLOSED; connectionState = cs_CLOSED;
} }
@Override
synchronized public void closeOutbound() { synchronized public void closeOutbound() {
/* /*
* Dump out a close_notify to the remote side * Dump out a close_notify to the remote side
...@@ -1491,6 +1496,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1491,6 +1496,7 @@ final public class SSLEngineImpl extends SSLEngine {
/** /**
* Returns the outbound application data closure state * Returns the outbound application data closure state
*/ */
@Override
public boolean isOutboundDone() { public boolean isOutboundDone() {
return writer.isOutboundDone(); return writer.isOutboundDone();
} }
...@@ -1527,6 +1533,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1527,6 +1533,7 @@ final public class SSLEngineImpl extends SSLEngine {
* lock here, and do the real work in the internal verison. * lock here, and do the real work in the internal verison.
* We do check for truncation attacks. * We do check for truncation attacks.
*/ */
@Override
synchronized public void closeInbound() throws SSLException { synchronized public void closeInbound() throws SSLException {
/* /*
* Currently closes the outbound side as well. The IETF TLS * Currently closes the outbound side as well. The IETF TLS
...@@ -1559,6 +1566,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1559,6 +1566,7 @@ final public class SSLEngineImpl extends SSLEngine {
/** /**
* Returns the network inbound data closure state * Returns the network inbound data closure state
*/ */
@Override
synchronized public boolean isInboundDone() { synchronized public boolean isInboundDone() {
return inboundDone; return inboundDone;
} }
...@@ -1576,6 +1584,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1576,6 +1584,7 @@ final public class SSLEngineImpl extends SSLEngine {
* These can be long lived, and frequently correspond to an * These can be long lived, and frequently correspond to an
* entire login session for some user. * entire login session for some user.
*/ */
@Override
synchronized public SSLSession getSession() { synchronized public SSLSession getSession() {
return sess; return sess;
} }
...@@ -1593,6 +1602,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1593,6 +1602,7 @@ final public class SSLEngineImpl extends SSLEngine {
* Returns a delegated <code>Runnable</code> task for * Returns a delegated <code>Runnable</code> task for
* this <code>SSLEngine</code>. * this <code>SSLEngine</code>.
*/ */
@Override
synchronized public Runnable getDelegatedTask() { synchronized public Runnable getDelegatedTask() {
if (handshaker != null) { if (handshaker != null) {
return handshaker.getTask(); return handshaker.getTask();
...@@ -1847,6 +1857,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1847,6 +1857,7 @@ final public class SSLEngineImpl extends SSLEngine {
* whether we enable session creations. Otherwise, * whether we enable session creations. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setEnableSessionCreation(boolean flag) { synchronized public void setEnableSessionCreation(boolean flag) {
enableSessionCreation = flag; enableSessionCreation = flag;
...@@ -1859,6 +1870,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1859,6 +1870,7 @@ final public class SSLEngineImpl extends SSLEngine {
* Returns true if new connections may cause creation of new SSL * Returns true if new connections may cause creation of new SSL
* sessions. * sessions.
*/ */
@Override
synchronized public boolean getEnableSessionCreation() { synchronized public boolean getEnableSessionCreation() {
return enableSessionCreation; return enableSessionCreation;
} }
...@@ -1872,6 +1884,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1872,6 +1884,7 @@ final public class SSLEngineImpl extends SSLEngine {
* whether client authentication is needed. Otherwise, * whether client authentication is needed. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setNeedClientAuth(boolean flag) { synchronized public void setNeedClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none);
...@@ -1883,6 +1896,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1883,6 +1896,7 @@ final public class SSLEngineImpl extends SSLEngine {
} }
} }
@Override
synchronized public boolean getNeedClientAuth() { synchronized public boolean getNeedClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_required); return (doClientAuth == SSLEngineImpl.clauth_required);
} }
...@@ -1895,6 +1909,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1895,6 +1909,7 @@ final public class SSLEngineImpl extends SSLEngine {
* whether client authentication is requested. Otherwise, * whether client authentication is requested. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setWantClientAuth(boolean flag) { synchronized public void setWantClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none);
...@@ -1906,6 +1921,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1906,6 +1921,7 @@ final public class SSLEngineImpl extends SSLEngine {
} }
} }
@Override
synchronized public boolean getWantClientAuth() { synchronized public boolean getWantClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_requested); return (doClientAuth == SSLEngineImpl.clauth_requested);
} }
...@@ -1916,6 +1932,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1916,6 +1932,7 @@ final public class SSLEngineImpl extends SSLEngine {
* client or server mode. Must be called before any SSL * client or server mode. Must be called before any SSL
* traffic has started. * traffic has started.
*/ */
@Override
@SuppressWarnings("fallthrough") @SuppressWarnings("fallthrough")
synchronized public void setUseClientMode(boolean flag) { synchronized public void setUseClientMode(boolean flag) {
switch (connectionState) { switch (connectionState) {
...@@ -1979,6 +1996,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1979,6 +1996,7 @@ final public class SSLEngineImpl extends SSLEngine {
} }
} }
@Override
synchronized public boolean getUseClientMode() { synchronized public boolean getUseClientMode() {
return !roleIsServer; return !roleIsServer;
} }
...@@ -1994,6 +2012,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -1994,6 +2012,7 @@ final public class SSLEngineImpl extends SSLEngine {
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
public String[] getSupportedCipherSuites() { public String[] getSupportedCipherSuites() {
return sslContext.getSupportedCipherSuiteList().toStringArray(); return sslContext.getSupportedCipherSuiteList().toStringArray();
} }
...@@ -2007,6 +2026,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2007,6 +2026,7 @@ final public class SSLEngineImpl extends SSLEngine {
* *
* @param suites Names of all the cipher suites to enable. * @param suites Names of all the cipher suites to enable.
*/ */
@Override
synchronized public void setEnabledCipherSuites(String[] suites) { synchronized public void setEnabledCipherSuites(String[] suites) {
enabledCipherSuites = new CipherSuiteList(suites); enabledCipherSuites = new CipherSuiteList(suites);
if ((handshaker != null) && !handshaker.activated()) { if ((handshaker != null) && !handshaker.activated()) {
...@@ -2024,6 +2044,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2024,6 +2044,7 @@ final public class SSLEngineImpl extends SSLEngine {
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
synchronized public String[] getEnabledCipherSuites() { synchronized public String[] getEnabledCipherSuites() {
return enabledCipherSuites.toStringArray(); return enabledCipherSuites.toStringArray();
} }
...@@ -2034,6 +2055,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2034,6 +2055,7 @@ final public class SSLEngineImpl extends SSLEngine {
* A subset of the supported protocols may be enabled for this connection * A subset of the supported protocols may be enabled for this connection
* @return an array of protocol names. * @return an array of protocol names.
*/ */
@Override
public String[] getSupportedProtocols() { public String[] getSupportedProtocols() {
return sslContext.getSuportedProtocolList().toStringArray(); return sslContext.getSuportedProtocolList().toStringArray();
} }
...@@ -2047,6 +2069,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2047,6 +2069,7 @@ final public class SSLEngineImpl extends SSLEngine {
* @exception IllegalArgumentException when one of the protocols * @exception IllegalArgumentException when one of the protocols
* named by the parameter is not supported. * named by the parameter is not supported.
*/ */
@Override
synchronized public void setEnabledProtocols(String[] protocols) { synchronized public void setEnabledProtocols(String[] protocols) {
enabledProtocols = new ProtocolList(protocols); enabledProtocols = new ProtocolList(protocols);
if ((handshaker != null) && !handshaker.activated()) { if ((handshaker != null) && !handshaker.activated()) {
...@@ -2054,6 +2077,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2054,6 +2077,7 @@ final public class SSLEngineImpl extends SSLEngine {
} }
} }
@Override
synchronized public String[] getEnabledProtocols() { synchronized public String[] getEnabledProtocols() {
return enabledProtocols.toStringArray(); return enabledProtocols.toStringArray();
} }
...@@ -2061,6 +2085,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2061,6 +2085,7 @@ final public class SSLEngineImpl extends SSLEngine {
/** /**
* Returns the SSLParameters in effect for this SSLEngine. * Returns the SSLParameters in effect for this SSLEngine.
*/ */
@Override
synchronized public SSLParameters getSSLParameters() { synchronized public SSLParameters getSSLParameters() {
SSLParameters params = super.getSSLParameters(); SSLParameters params = super.getSSLParameters();
...@@ -2076,6 +2101,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2076,6 +2101,7 @@ final public class SSLEngineImpl extends SSLEngine {
/** /**
* Applies SSLParameters to this engine. * Applies SSLParameters to this engine.
*/ */
@Override
synchronized public void setSSLParameters(SSLParameters params) { synchronized public void setSSLParameters(SSLParameters params) {
super.setSSLParameters(params); super.setSSLParameters(params);
...@@ -2107,6 +2133,7 @@ final public class SSLEngineImpl extends SSLEngine { ...@@ -2107,6 +2133,7 @@ final public class SSLEngineImpl extends SSLEngine {
/** /**
* Returns a printable representation of this end of the connection. * Returns a printable representation of this end of the connection.
*/ */
@Override
public String toString() { public String toString() {
StringBuilder retval = new StringBuilder(80); StringBuilder retval = new StringBuilder(80);
......
...@@ -67,10 +67,12 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory ...@@ -67,10 +67,12 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
* @throws IOException if the socket cannot be created * @throws IOException if the socket cannot be created
* @see java.net.Socket#bind(java.net.SocketAddress) * @see java.net.Socket#bind(java.net.SocketAddress)
*/ */
@Override
public ServerSocket createServerSocket() throws IOException { public ServerSocket createServerSocket() throws IOException {
return new SSLServerSocketImpl(context); return new SSLServerSocketImpl(context);
} }
@Override
public ServerSocket createServerSocket (int port) public ServerSocket createServerSocket (int port)
throws IOException throws IOException
{ {
...@@ -78,12 +80,14 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory ...@@ -78,12 +80,14 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
} }
@Override
public ServerSocket createServerSocket (int port, int backlog) public ServerSocket createServerSocket (int port, int backlog)
throws IOException throws IOException
{ {
return new SSLServerSocketImpl (port, backlog, context); return new SSLServerSocketImpl (port, backlog, context);
} }
@Override
public ServerSocket public ServerSocket
createServerSocket (int port, int backlog, InetAddress ifAddress) createServerSocket (int port, int backlog, InetAddress ifAddress)
throws IOException throws IOException
...@@ -98,6 +102,7 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory ...@@ -98,6 +102,7 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
* (preventing person-in-the-middle attacks) and where traffic * (preventing person-in-the-middle attacks) and where traffic
* is encrypted to provide confidentiality. * is encrypted to provide confidentiality.
*/ */
@Override
public String[] getDefaultCipherSuites() { public String[] getDefaultCipherSuites() {
return context.getDefaultCipherSuiteList(true).toStringArray(); return context.getDefaultCipherSuiteList(true).toStringArray();
} }
...@@ -112,6 +117,7 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory ...@@ -112,6 +117,7 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
public String[] getSupportedCipherSuites() { public String[] getSupportedCipherSuites() {
return context.getSupportedCipherSuiteList().toStringArray(); return context.getSupportedCipherSuiteList().toStringArray();
} }
......
...@@ -29,13 +29,11 @@ package sun.security.ssl; ...@@ -29,13 +29,11 @@ package sun.security.ssl;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.Socket; import java.net.Socket;
import java.net.ServerSocket;
import java.security.AlgorithmConstraints; import java.security.AlgorithmConstraints;
import java.util.*; import java.util.*;
import javax.net.ServerSocketFactory;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLParameters;
...@@ -172,6 +170,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -172,6 +170,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
public String[] getSupportedCipherSuites() { public String[] getSupportedCipherSuites() {
return sslContext.getSupportedCipherSuiteList().toStringArray(); return sslContext.getSupportedCipherSuiteList().toStringArray();
} }
...@@ -181,6 +180,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -181,6 +180,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* for use by newly accepted connections. A null return indicates * for use by newly accepted connections. A null return indicates
* that the system defaults are in effect. * that the system defaults are in effect.
*/ */
@Override
synchronized public String[] getEnabledCipherSuites() { synchronized public String[] getEnabledCipherSuites() {
return enabledCipherSuites.toStringArray(); return enabledCipherSuites.toStringArray();
} }
...@@ -192,11 +192,13 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -192,11 +192,13 @@ class SSLServerSocketImpl extends SSLServerSocket
* @param suites Names of all the cipher suites to enable; null * @param suites Names of all the cipher suites to enable; null
* means to accept system defaults. * means to accept system defaults.
*/ */
@Override
synchronized public void setEnabledCipherSuites(String[] suites) { synchronized public void setEnabledCipherSuites(String[] suites) {
enabledCipherSuites = new CipherSuiteList(suites); enabledCipherSuites = new CipherSuiteList(suites);
checkedEnabled = false; checkedEnabled = false;
} }
@Override
public String[] getSupportedProtocols() { public String[] getSupportedProtocols() {
return sslContext.getSuportedProtocolList().toStringArray(); return sslContext.getSuportedProtocolList().toStringArray();
} }
...@@ -210,10 +212,12 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -210,10 +212,12 @@ class SSLServerSocketImpl extends SSLServerSocket
* @exception IllegalArgumentException when one of the protocols * @exception IllegalArgumentException when one of the protocols
* named by the parameter is not supported. * named by the parameter is not supported.
*/ */
@Override
synchronized public void setEnabledProtocols(String[] protocols) { synchronized public void setEnabledProtocols(String[] protocols) {
enabledProtocols = new ProtocolList(protocols); enabledProtocols = new ProtocolList(protocols);
} }
@Override
synchronized public String[] getEnabledProtocols() { synchronized public String[] getEnabledProtocols() {
return enabledProtocols.toStringArray(); return enabledProtocols.toStringArray();
} }
...@@ -222,11 +226,13 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -222,11 +226,13 @@ class SSLServerSocketImpl extends SSLServerSocket
* Controls whether the connections which are accepted must include * Controls whether the connections which are accepted must include
* client authentication. * client authentication.
*/ */
@Override
public void setNeedClientAuth(boolean flag) { public void setNeedClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none);
} }
@Override
public boolean getNeedClientAuth() { public boolean getNeedClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_required); return (doClientAuth == SSLEngineImpl.clauth_required);
} }
...@@ -235,11 +241,13 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -235,11 +241,13 @@ class SSLServerSocketImpl extends SSLServerSocket
* Controls whether the connections which are accepted should request * Controls whether the connections which are accepted should request
* client authentication. * client authentication.
*/ */
@Override
public void setWantClientAuth(boolean flag) { public void setWantClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none);
} }
@Override
public boolean getWantClientAuth() { public boolean getWantClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_requested); return (doClientAuth == SSLEngineImpl.clauth_requested);
} }
...@@ -250,6 +258,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -250,6 +258,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* FTP clients, which accept connections from servers and should be * FTP clients, which accept connections from servers and should be
* rejoining the already-negotiated SSL connection. * rejoining the already-negotiated SSL connection.
*/ */
@Override
public void setUseClientMode(boolean flag) { public void setUseClientMode(boolean flag) {
/* /*
* If we need to change the socket mode and the enabled * If we need to change the socket mode and the enabled
...@@ -264,6 +273,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -264,6 +273,7 @@ class SSLServerSocketImpl extends SSLServerSocket
useServerMode = !flag; useServerMode = !flag;
} }
@Override
public boolean getUseClientMode() { public boolean getUseClientMode() {
return !useServerMode; return !useServerMode;
} }
...@@ -273,6 +283,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -273,6 +283,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* Controls whether new connections may cause creation of new SSL * Controls whether new connections may cause creation of new SSL
* sessions. * sessions.
*/ */
@Override
public void setEnableSessionCreation(boolean flag) { public void setEnableSessionCreation(boolean flag) {
enableSessionCreation = flag; enableSessionCreation = flag;
} }
...@@ -281,6 +292,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -281,6 +292,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* Returns true if new connections may cause creation of new SSL * Returns true if new connections may cause creation of new SSL
* sessions. * sessions.
*/ */
@Override
public boolean getEnableSessionCreation() { public boolean getEnableSessionCreation() {
return enableSessionCreation; return enableSessionCreation;
} }
...@@ -288,6 +300,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -288,6 +300,7 @@ class SSLServerSocketImpl extends SSLServerSocket
/** /**
* Returns the SSLParameters in effect for newly accepted connections. * Returns the SSLParameters in effect for newly accepted connections.
*/ */
@Override
synchronized public SSLParameters getSSLParameters() { synchronized public SSLParameters getSSLParameters() {
SSLParameters params = super.getSSLParameters(); SSLParameters params = super.getSSLParameters();
...@@ -302,6 +315,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -302,6 +315,7 @@ class SSLServerSocketImpl extends SSLServerSocket
/** /**
* Applies SSLParameters to newly accepted connections. * Applies SSLParameters to newly accepted connections.
*/ */
@Override
synchronized public void setSSLParameters(SSLParameters params) { synchronized public void setSSLParameters(SSLParameters params) {
super.setSSLParameters(params); super.setSSLParameters(params);
...@@ -319,6 +333,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -319,6 +333,7 @@ class SSLServerSocketImpl extends SSLServerSocket
* information provided in the authentication context which was * information provided in the authentication context which was
* presented during construction. * presented during construction.
*/ */
@Override
public Socket accept() throws IOException { public Socket accept() throws IOException {
SSLSocketImpl s = new SSLSocketImpl(sslContext, useServerMode, SSLSocketImpl s = new SSLSocketImpl(sslContext, useServerMode,
enabledCipherSuites, doClientAuth, enableSessionCreation, enabledCipherSuites, doClientAuth, enableSessionCreation,
...@@ -333,6 +348,7 @@ class SSLServerSocketImpl extends SSLServerSocket ...@@ -333,6 +348,7 @@ class SSLServerSocketImpl extends SSLServerSocket
/** /**
* Provides a brief description of this SSL socket. * Provides a brief description of this SSL socket.
*/ */
@Override
public String toString() { public String toString() {
return "[SSL: "+ super.toString() + "]"; return "[SSL: "+ super.toString() + "]";
} }
......
...@@ -26,24 +26,14 @@ ...@@ -26,24 +26,14 @@
package sun.security.ssl; package sun.security.ssl;
import java.io.*;
import java.net.*;
import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable;
import java.util.NoSuchElementException;
import java.util.Vector; import java.util.Vector;
import java.util.Locale; import java.util.Locale;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSessionContext; import javax.net.ssl.SSLSessionContext;
import javax.net.ssl.SSLSessionBindingListener;
import javax.net.ssl.SSLSessionBindingEvent;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import sun.security.util.Cache; import sun.security.util.Cache;
import sun.security.util.Cache.CacheVisitor;
final class SSLSessionContextImpl implements SSLSessionContext { final class SSLSessionContextImpl implements SSLSessionContext {
...@@ -69,6 +59,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -69,6 +59,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
/** /**
* Returns the <code>SSLSession</code> bound to the specified session id. * Returns the <code>SSLSession</code> bound to the specified session id.
*/ */
@Override
public SSLSession getSession(byte[] sessionId) { public SSLSession getSession(byte[] sessionId) {
if (sessionId == null) { if (sessionId == null) {
throw new NullPointerException("session id cannot be null"); throw new NullPointerException("session id cannot be null");
...@@ -85,6 +76,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -85,6 +76,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
/** /**
* Returns an enumeration of the active SSL sessions. * Returns an enumeration of the active SSL sessions.
*/ */
@Override
public Enumeration<byte[]> getIds() { public Enumeration<byte[]> getIds() {
SessionCacheVisitor scVisitor = new SessionCacheVisitor(); SessionCacheVisitor scVisitor = new SessionCacheVisitor();
sessionCache.accept(scVisitor); sessionCache.accept(scVisitor);
...@@ -99,6 +91,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -99,6 +91,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
* should be timed within the shorter one of the old timeout and the * should be timed within the shorter one of the old timeout and the
* new timeout. * new timeout.
*/ */
@Override
public void setSessionTimeout(int seconds) public void setSessionTimeout(int seconds)
throws IllegalArgumentException { throws IllegalArgumentException {
if (seconds < 0) { if (seconds < 0) {
...@@ -115,6 +108,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -115,6 +108,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
/** /**
* Gets the timeout limit for cached <code>SSLSession</code> objects * Gets the timeout limit for cached <code>SSLSession</code> objects
*/ */
@Override
public int getSessionTimeout() { public int getSessionTimeout() {
return timeout; return timeout;
} }
...@@ -123,6 +117,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -123,6 +117,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
* Sets the size of the cache used for storing * Sets the size of the cache used for storing
* <code>SSLSession</code> objects. * <code>SSLSession</code> objects.
*/ */
@Override
public void setSessionCacheSize(int size) public void setSessionCacheSize(int size)
throws IllegalArgumentException { throws IllegalArgumentException {
if (size < 0) if (size < 0)
...@@ -139,6 +134,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -139,6 +134,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
* Gets the size of the cache used for storing * Gets the size of the cache used for storing
* <code>SSLSession</code> objects. * <code>SSLSession</code> objects.
*/ */
@Override
public int getSessionCacheSize() { public int getSessionCacheSize() {
return cacheLimit; return cacheLimit;
} }
...@@ -207,6 +203,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -207,6 +203,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
try { try {
String s = java.security.AccessController.doPrivileged( String s = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<String>() { new java.security.PrivilegedAction<String>() {
@Override
public String run() { public String run() {
return System.getProperty( return System.getProperty(
"javax.net.ssl.sessionCacheSize"); "javax.net.ssl.sessionCacheSize");
...@@ -238,6 +235,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { ...@@ -238,6 +235,7 @@ final class SSLSessionContextImpl implements SSLSessionContext {
Vector<byte[]> ids = null; Vector<byte[]> ids = null;
// public void visit(java.util.Map<K,V> map) {} // public void visit(java.util.Map<K,V> map) {}
@Override
public void visit(java.util.Map<SessionId, SSLSessionImpl> map) { public void visit(java.util.Map<SessionId, SSLSessionImpl> map) {
ids = new Vector<>(map.size()); ids = new Vector<>(map.size());
......
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
package sun.security.ssl; package sun.security.ssl;
import java.io.*;
import java.net.*; import java.net.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -45,20 +43,14 @@ import java.security.cert.CertificateEncodingException; ...@@ -45,20 +43,14 @@ import java.security.cert.CertificateEncodingException;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSessionContext; import javax.net.ssl.SSLSessionContext;
import javax.net.ssl.SSLSessionBindingListener; import javax.net.ssl.SSLSessionBindingListener;
import javax.net.ssl.SSLSessionBindingEvent; import javax.net.ssl.SSLSessionBindingEvent;
import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLPermission; import javax.net.ssl.SSLPermission;
import javax.net.ssl.SSLException;
import javax.net.ssl.ExtendedSSLSession; import javax.net.ssl.ExtendedSSLSession;
import javax.net.ssl.SNIServerName; import javax.net.ssl.SNIServerName;
import javax.security.auth.x500.X500Principal;
import static sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.KeyExchange.*; import static sun.security.ssl.CipherSuite.KeyExchange.*;
/** /**
...@@ -250,6 +242,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -250,6 +242,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
!invalidated && isLocalAuthenticationValid(); !invalidated && isLocalAuthenticationValid();
} }
@Override
public synchronized boolean isValid() { public synchronized boolean isValid() {
return isRejoinable(); return isRejoinable();
} }
...@@ -277,6 +270,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -277,6 +270,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Returns the ID for this session. The ID is fixed for the * Returns the ID for this session. The ID is fixed for the
* duration of the session; neither it, nor its value, changes. * duration of the session; neither it, nor its value, changes.
*/ */
@Override
public byte[] getId() { public byte[] getId() {
return sessionId.getId(); return sessionId.getId();
} }
...@@ -286,6 +280,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -286,6 +280,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* are currently valid in this process. For client sessions, * are currently valid in this process. For client sessions,
* this returns null. * this returns null.
*/ */
@Override
public SSLSessionContext getSessionContext() { public SSLSessionContext getSessionContext() {
/* /*
* An interim security policy until we can do something * An interim security policy until we can do something
...@@ -332,6 +327,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -332,6 +327,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns the name of the cipher suite in use on this session * Returns the name of the cipher suite in use on this session
*/ */
@Override
public String getCipherSuite() { public String getCipherSuite() {
return getSuite().name; return getSuite().name;
} }
...@@ -343,6 +339,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -343,6 +339,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns the standard name of the protocol in use on this session * Returns the standard name of the protocol in use on this session
*/ */
@Override
public String getProtocol() { public String getProtocol() {
return getProtocolVersion().name; return getProtocolVersion().name;
} }
...@@ -357,6 +354,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -357,6 +354,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns the hashcode for this session * Returns the hashcode for this session
*/ */
@Override
public int hashCode() { public int hashCode() {
return sessionId.hashCode(); return sessionId.hashCode();
} }
...@@ -365,6 +363,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -365,6 +363,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns true if sessions have same ids, false otherwise. * Returns true if sessions have same ids, false otherwise.
*/ */
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { if (obj == this) {
...@@ -391,6 +390,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -391,6 +390,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* @return array of peer X.509 certs, with the peer's own cert * @return array of peer X.509 certs, with the peer's own cert
* first in the chain, and with the "root" CA last. * first in the chain, and with the "root" CA last.
*/ */
@Override
public java.security.cert.Certificate[] getPeerCertificates() public java.security.cert.Certificate[] getPeerCertificates()
throws SSLPeerUnverifiedException { throws SSLPeerUnverifiedException {
// //
...@@ -421,6 +421,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -421,6 +421,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* @return array of peer X.509 certs, with the peer's own cert * @return array of peer X.509 certs, with the peer's own cert
* first in the chain, and with the "root" CA last. * first in the chain, and with the "root" CA last.
*/ */
@Override
public java.security.cert.Certificate[] getLocalCertificates() { public java.security.cert.Certificate[] getLocalCertificates() {
// //
// clone to preserve integrity of session ... caller can't // clone to preserve integrity of session ... caller can't
...@@ -440,6 +441,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -440,6 +441,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* @return array of peer X.509 certs, with the peer's own cert * @return array of peer X.509 certs, with the peer's own cert
* first in the chain, and with the "root" CA last. * first in the chain, and with the "root" CA last.
*/ */
@Override
public javax.security.cert.X509Certificate[] getPeerCertificateChain() public javax.security.cert.X509Certificate[] getPeerCertificateChain()
throws SSLPeerUnverifiedException { throws SSLPeerUnverifiedException {
// //
...@@ -511,6 +513,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -511,6 +513,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* @throws SSLPeerUnverifiedException if the peer's identity has not * @throws SSLPeerUnverifiedException if the peer's identity has not
* been verified * been verified
*/ */
@Override
public Principal getPeerPrincipal() public Principal getPeerPrincipal()
throws SSLPeerUnverifiedException throws SSLPeerUnverifiedException
{ {
...@@ -537,6 +540,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -537,6 +540,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Principal for Kerberos cipher suites. If no principal was * Principal for Kerberos cipher suites. If no principal was
* sent, then null is returned. * sent, then null is returned.
*/ */
@Override
public Principal getLocalPrincipal() { public Principal getLocalPrincipal() {
if ((cipherSuite.keyExchange == K_KRB5) || if ((cipherSuite.keyExchange == K_KRB5) ||
...@@ -551,6 +555,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -551,6 +555,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns the time this session was created. * Returns the time this session was created.
*/ */
@Override
public long getCreationTime() { public long getCreationTime() {
return creationTime; return creationTime;
} }
...@@ -559,6 +564,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -559,6 +564,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Returns the last time this session was used to initialize * Returns the last time this session was used to initialize
* a connection. * a connection.
*/ */
@Override
public long getLastAccessedTime() { public long getLastAccessedTime() {
return (lastUsedTime != 0) ? lastUsedTime : creationTime; return (lastUsedTime != 0) ? lastUsedTime : creationTime;
} }
...@@ -582,6 +588,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -582,6 +588,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
} }
} }
@Override
public String getPeerHost() { public String getPeerHost() {
return host; return host;
} }
...@@ -590,6 +597,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -590,6 +597,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Need to provide the port info for caching sessions based on * Need to provide the port info for caching sessions based on
* host and port. Accessed by SSLSessionContextImpl * host and port. Accessed by SSLSessionContextImpl
*/ */
@Override
public int getPeerPort() { public int getPeerPort() {
return port; return port;
} }
...@@ -604,6 +612,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -604,6 +612,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Invalidate a session. Active connections may still exist, but * Invalidate a session. Active connections may still exist, but
* no connections will be able to rejoin this session. * no connections will be able to rejoin this session.
*/ */
@Override
synchronized public void invalidate() { synchronized public void invalidate() {
// //
// Can't invalidate the NULL session -- this would be // Can't invalidate the NULL session -- this would be
...@@ -634,6 +643,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -634,6 +643,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Assigns a session value. Session change events are given if * Assigns a session value. Session change events are given if
* appropriate, to any original value as well as the new value. * appropriate, to any original value as well as the new value.
*/ */
@Override
public void putValue(String key, Object value) { public void putValue(String key, Object value) {
if ((key == null) || (value == null)) { if ((key == null) || (value == null)) {
throw new IllegalArgumentException("arguments can not be null"); throw new IllegalArgumentException("arguments can not be null");
...@@ -660,6 +670,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -660,6 +670,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Returns the specified session value. * Returns the specified session value.
*/ */
@Override
public Object getValue(String key) { public Object getValue(String key) {
if (key == null) { if (key == null) {
throw new IllegalArgumentException("argument can not be null"); throw new IllegalArgumentException("argument can not be null");
...@@ -674,6 +685,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -674,6 +685,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Removes the specified session value, delivering a session changed * Removes the specified session value, delivering a session changed
* event as appropriate. * event as appropriate.
*/ */
@Override
public void removeValue(String key) { public void removeValue(String key) {
if (key == null) { if (key == null) {
throw new IllegalArgumentException("argument can not be null"); throw new IllegalArgumentException("argument can not be null");
...@@ -694,6 +706,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -694,6 +706,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
/** /**
* Lists the names of the session values. * Lists the names of the session values.
*/ */
@Override
public String[] getValueNames() { public String[] getValueNames() {
Enumeration<SecureKey> e; Enumeration<SecureKey> e;
Vector<Object> v = new Vector<>(); Vector<Object> v = new Vector<>();
...@@ -741,6 +754,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -741,6 +754,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Gets the current size of the largest SSL/TLS packet that is expected * Gets the current size of the largest SSL/TLS packet that is expected
* when using this session. * when using this session.
*/ */
@Override
public synchronized int getPacketBufferSize() { public synchronized int getPacketBufferSize() {
return acceptLargeFragments ? return acceptLargeFragments ?
Record.maxLargeRecordSize : Record.maxRecordSize; Record.maxLargeRecordSize : Record.maxRecordSize;
...@@ -750,6 +764,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -750,6 +764,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* Gets the current size of the largest application data that is * Gets the current size of the largest application data that is
* expected when using this session. * expected when using this session.
*/ */
@Override
public synchronized int getApplicationBufferSize() { public synchronized int getApplicationBufferSize() {
return getPacketBufferSize() - Record.headerSize; return getPacketBufferSize() - Record.headerSize;
} }
...@@ -795,6 +810,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -795,6 +810,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
} }
/** Returns a string representation of this SSL session */ /** Returns a string representation of this SSL session */
@Override
public String toString() { public String toString() {
return "[Session-" + sessionCount return "[Session-" + sessionCount
+ ", " + getCipherSuite() + ", " + getCipherSuite()
...@@ -805,6 +821,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { ...@@ -805,6 +821,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
* When SSL sessions are finalized, all values bound to * When SSL sessions are finalized, all values bound to
* them are removed. * them are removed.
*/ */
@Override
public void finalize() { public void finalize() {
String[] names = getValueNames(); String[] names = getValueNames();
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {
...@@ -847,10 +864,12 @@ class SecureKey { ...@@ -847,10 +864,12 @@ class SecureKey {
return securityCtx; return securityCtx;
} }
@Override
public int hashCode() { public int hashCode() {
return appKey.hashCode() ^ securityCtx.hashCode(); return appKey.hashCode() ^ securityCtx.hashCode();
} }
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
return o instanceof SecureKey && ((SecureKey)o).appKey.equals(appKey) return o instanceof SecureKey && ((SecureKey)o).appKey.equals(appKey)
&& ((SecureKey)o).securityCtx.equals(securityCtx); && ((SecureKey)o).securityCtx.equals(securityCtx);
......
...@@ -28,7 +28,6 @@ package sun.security.ssl; ...@@ -28,7 +28,6 @@ package sun.security.ssl;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.SSLSocket;
/** /**
...@@ -69,6 +68,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -69,6 +68,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* @return the unconnected socket * @return the unconnected socket
* @see java.net.Socket#connect(java.net.SocketAddress, int) * @see java.net.Socket#connect(java.net.SocketAddress, int)
*/ */
@Override
public Socket createSocket() { public Socket createSocket() {
return new SSLSocketImpl(context); return new SSLSocketImpl(context);
} }
...@@ -82,6 +82,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -82,6 +82,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* @param host name of the host with which to connect * @param host name of the host with which to connect
* @param port number of the server's port * @param port number of the server's port
*/ */
@Override
public Socket createSocket(String host, int port) public Socket createSocket(String host, int port)
throws IOException, UnknownHostException throws IOException, UnknownHostException
{ {
...@@ -104,6 +105,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -104,6 +105,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* @exception IOException if the connection can't be established * @exception IOException if the connection can't be established
* @exception UnknownHostException if the host is not known * @exception UnknownHostException if the host is not known
*/ */
@Override
public Socket createSocket(Socket s, String host, int port, public Socket createSocket(Socket s, String host, int port,
boolean autoClose) throws IOException { boolean autoClose) throws IOException {
return new SSLSocketImpl(context, s, host, port, autoClose); return new SSLSocketImpl(context, s, host, port, autoClose);
...@@ -129,6 +131,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -129,6 +131,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* @param address the server's host * @param address the server's host
* @param port its port * @param port its port
*/ */
@Override
public Socket createSocket(InetAddress address, int port) public Socket createSocket(InetAddress address, int port)
throws IOException throws IOException
{ {
...@@ -143,6 +146,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -143,6 +146,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* has been configured. The socket will also bind() to the local * has been configured. The socket will also bind() to the local
* address and port supplied. * address and port supplied.
*/ */
@Override
public Socket createSocket(String host, int port, public Socket createSocket(String host, int port,
InetAddress clientAddress, int clientPort) InetAddress clientAddress, int clientPort)
throws IOException throws IOException
...@@ -158,6 +162,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -158,6 +162,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* context which has been configured. The socket will also bind() to * context which has been configured. The socket will also bind() to
* the local address and port supplied. * the local address and port supplied.
*/ */
@Override
public Socket createSocket(InetAddress address, int port, public Socket createSocket(InetAddress address, int port,
InetAddress clientAddress, int clientPort) InetAddress clientAddress, int clientPort)
throws IOException throws IOException
...@@ -174,6 +179,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -174,6 +179,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* (preventing person-in-the-middle attacks) and where traffic * (preventing person-in-the-middle attacks) and where traffic
* is encrypted to provide confidentiality. * is encrypted to provide confidentiality.
*/ */
@Override
public String[] getDefaultCipherSuites() { public String[] getDefaultCipherSuites() {
return context.getDefaultCipherSuiteList(false).toStringArray(); return context.getDefaultCipherSuiteList(false).toStringArray();
} }
...@@ -186,6 +192,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory { ...@@ -186,6 +192,7 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
* which do not protect data confidentiality. Servers may also need * which do not protect data confidentiality. Servers may also need
* certain kinds of certificates to use certain cipher suites. * certain kinds of certificates to use certain cipher suites.
*/ */
@Override
public String[] getSupportedCipherSuites() { public String[] getSupportedCipherSuites() {
return context.getSupportedCipherSuiteList().toStringArray(); return context.getSupportedCipherSuiteList().toStringArray();
} }
......
...@@ -36,7 +36,6 @@ import java.security.AlgorithmConstraints; ...@@ -36,7 +36,6 @@ import java.security.AlgorithmConstraints;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.nio.charset.StandardCharsets;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.net.ssl.*; import javax.net.ssl.*;
...@@ -626,6 +625,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -626,6 +625,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* @throws IOException if an error occurs during the connection * @throws IOException if an error occurs during the connection
* @throws SocketTimeoutException if timeout expires before connecting * @throws SocketTimeoutException if timeout expires before connecting
*/ */
@Override
public void connect(SocketAddress endpoint, int timeout) public void connect(SocketAddress endpoint, int timeout)
throws IOException { throws IOException {
...@@ -1357,6 +1357,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -1357,6 +1357,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Starts an SSL handshake on this connection. * Starts an SSL handshake on this connection.
*/ */
@Override
public void startHandshake() throws IOException { public void startHandshake() throws IOException {
// start an ssl handshake that could be resumed from timeout exception // start an ssl handshake that could be resumed from timeout exception
startHandshake(true); startHandshake(true);
...@@ -1481,6 +1482,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -1481,6 +1482,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Return whether the socket has been explicitly closed by the application. * Return whether the socket has been explicitly closed by the application.
*/ */
@Override
public boolean isClosed() { public boolean isClosed() {
return getConnectionState() == cs_APP_CLOSED; return getConnectionState() == cs_APP_CLOSED;
} }
...@@ -1567,6 +1569,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -1567,6 +1569,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* rather than leaving it for finalization, so that your remote * rather than leaving it for finalization, so that your remote
* peer does not experience a protocol error. * peer does not experience a protocol error.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
if ((debug != null) && Debug.isOn("ssl")) { if ((debug != null) && Debug.isOn("ssl")) {
System.out.println(Thread.currentThread().getName() + System.out.println(Thread.currentThread().getName() +
...@@ -2155,6 +2158,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2155,6 +2158,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* Data read from this stream was always integrity protected in * Data read from this stream was always integrity protected in
* transit, and will usually have been confidentiality protected. * transit, and will usually have been confidentiality protected.
*/ */
@Override
synchronized public InputStream getInputStream() throws IOException { synchronized public InputStream getInputStream() throws IOException {
if (isClosed()) { if (isClosed()) {
throw new SocketException("Socket is closed"); throw new SocketException("Socket is closed");
...@@ -2176,6 +2180,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2176,6 +2180,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* Data written on this stream is always integrity protected, and * Data written on this stream is always integrity protected, and
* will usually be confidentiality protected. * will usually be confidentiality protected.
*/ */
@Override
synchronized public OutputStream getOutputStream() throws IOException { synchronized public OutputStream getOutputStream() throws IOException {
if (isClosed()) { if (isClosed()) {
throw new SocketException("Socket is closed"); throw new SocketException("Socket is closed");
...@@ -2197,6 +2202,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2197,6 +2202,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* be long lived, and frequently correspond to an entire login session * be long lived, and frequently correspond to an entire login session
* for some user. * for some user.
*/ */
@Override
public SSLSession getSession() { public SSLSession getSession() {
/* /*
* Force a synchronous handshake, if appropriate. * Force a synchronous handshake, if appropriate.
...@@ -2235,6 +2241,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2235,6 +2241,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* whether we enable session creations. Otherwise, * whether we enable session creations. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setEnableSessionCreation(boolean flag) { synchronized public void setEnableSessionCreation(boolean flag) {
enableSessionCreation = flag; enableSessionCreation = flag;
...@@ -2247,6 +2254,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2247,6 +2254,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* Returns true if new connections may cause creation of new SSL * Returns true if new connections may cause creation of new SSL
* sessions. * sessions.
*/ */
@Override
synchronized public boolean getEnableSessionCreation() { synchronized public boolean getEnableSessionCreation() {
return enableSessionCreation; return enableSessionCreation;
} }
...@@ -2260,6 +2268,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2260,6 +2268,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* whether client authentication is needed. Otherwise, * whether client authentication is needed. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setNeedClientAuth(boolean flag) { synchronized public void setNeedClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_required : SSLEngineImpl.clauth_none);
...@@ -2271,6 +2280,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2271,6 +2280,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
} }
} }
@Override
synchronized public boolean getNeedClientAuth() { synchronized public boolean getNeedClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_required); return (doClientAuth == SSLEngineImpl.clauth_required);
} }
...@@ -2283,6 +2293,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2283,6 +2293,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* whether client authentication is requested. Otherwise, * whether client authentication is requested. Otherwise,
* we will need to wait for the next handshake. * we will need to wait for the next handshake.
*/ */
@Override
synchronized public void setWantClientAuth(boolean flag) { synchronized public void setWantClientAuth(boolean flag) {
doClientAuth = (flag ? doClientAuth = (flag ?
SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none); SSLEngineImpl.clauth_requested : SSLEngineImpl.clauth_none);
...@@ -2294,6 +2305,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2294,6 +2305,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
} }
} }
@Override
synchronized public boolean getWantClientAuth() { synchronized public boolean getWantClientAuth() {
return (doClientAuth == SSLEngineImpl.clauth_requested); return (doClientAuth == SSLEngineImpl.clauth_requested);
} }
...@@ -2304,6 +2316,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2304,6 +2316,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* client or server mode. Must be called before any SSL * client or server mode. Must be called before any SSL
* traffic has started. * traffic has started.
*/ */
@Override
@SuppressWarnings("fallthrough") @SuppressWarnings("fallthrough")
synchronized public void setUseClientMode(boolean flag) { synchronized public void setUseClientMode(boolean flag) {
switch (connectionState) { switch (connectionState) {
...@@ -2359,6 +2372,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2359,6 +2372,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
} }
} }
@Override
synchronized public boolean getUseClientMode() { synchronized public boolean getUseClientMode() {
return !roleIsServer; return !roleIsServer;
} }
...@@ -2374,6 +2388,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2374,6 +2388,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
public String[] getSupportedCipherSuites() { public String[] getSupportedCipherSuites() {
return sslContext.getSupportedCipherSuiteList().toStringArray(); return sslContext.getSupportedCipherSuiteList().toStringArray();
} }
...@@ -2387,6 +2402,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2387,6 +2402,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* *
* @param suites Names of all the cipher suites to enable. * @param suites Names of all the cipher suites to enable.
*/ */
@Override
synchronized public void setEnabledCipherSuites(String[] suites) { synchronized public void setEnabledCipherSuites(String[] suites) {
enabledCipherSuites = new CipherSuiteList(suites); enabledCipherSuites = new CipherSuiteList(suites);
if ((handshaker != null) && !handshaker.activated()) { if ((handshaker != null) && !handshaker.activated()) {
...@@ -2404,6 +2420,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2404,6 +2420,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* *
* @return an array of cipher suite names * @return an array of cipher suite names
*/ */
@Override
synchronized public String[] getEnabledCipherSuites() { synchronized public String[] getEnabledCipherSuites() {
return enabledCipherSuites.toStringArray(); return enabledCipherSuites.toStringArray();
} }
...@@ -2414,6 +2431,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2414,6 +2431,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* A subset of the supported protocols may be enabled for this connection * A subset of the supported protocols may be enabled for this connection
* @return an array of protocol names. * @return an array of protocol names.
*/ */
@Override
public String[] getSupportedProtocols() { public String[] getSupportedProtocols() {
return sslContext.getSuportedProtocolList().toStringArray(); return sslContext.getSuportedProtocolList().toStringArray();
} }
...@@ -2427,6 +2445,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2427,6 +2445,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* @exception IllegalArgumentException when one of the protocols * @exception IllegalArgumentException when one of the protocols
* named by the parameter is not supported. * named by the parameter is not supported.
*/ */
@Override
synchronized public void setEnabledProtocols(String[] protocols) { synchronized public void setEnabledProtocols(String[] protocols) {
enabledProtocols = new ProtocolList(protocols); enabledProtocols = new ProtocolList(protocols);
if ((handshaker != null) && !handshaker.activated()) { if ((handshaker != null) && !handshaker.activated()) {
...@@ -2434,6 +2453,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2434,6 +2453,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
} }
} }
@Override
synchronized public String[] getEnabledProtocols() { synchronized public String[] getEnabledProtocols() {
return enabledProtocols.toStringArray(); return enabledProtocols.toStringArray();
} }
...@@ -2442,6 +2462,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2442,6 +2462,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* Assigns the socket timeout. * Assigns the socket timeout.
* @see java.net.Socket#setSoTimeout * @see java.net.Socket#setSoTimeout
*/ */
@Override
public void setSoTimeout(int timeout) throws SocketException { public void setSoTimeout(int timeout) throws SocketException {
if ((debug != null) && Debug.isOn("ssl")) { if ((debug != null) && Debug.isOn("ssl")) {
System.out.println(Thread.currentThread().getName() + System.out.println(Thread.currentThread().getName() +
...@@ -2455,6 +2476,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2455,6 +2476,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
* Registers an event listener to receive notifications that an * Registers an event listener to receive notifications that an
* SSL handshake has completed on this connection. * SSL handshake has completed on this connection.
*/ */
@Override
public synchronized void addHandshakeCompletedListener( public synchronized void addHandshakeCompletedListener(
HandshakeCompletedListener listener) { HandshakeCompletedListener listener) {
if (listener == null) { if (listener == null) {
...@@ -2471,6 +2493,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2471,6 +2493,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Removes a previously registered handshake completion listener. * Removes a previously registered handshake completion listener.
*/ */
@Override
public synchronized void removeHandshakeCompletedListener( public synchronized void removeHandshakeCompletedListener(
HandshakeCompletedListener listener) { HandshakeCompletedListener listener) {
if (handshakeListeners == null) { if (handshakeListeners == null) {
...@@ -2487,6 +2510,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2487,6 +2510,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Returns the SSLParameters in effect for this SSLSocket. * Returns the SSLParameters in effect for this SSLSocket.
*/ */
@Override
synchronized public SSLParameters getSSLParameters() { synchronized public SSLParameters getSSLParameters() {
SSLParameters params = super.getSSLParameters(); SSLParameters params = super.getSSLParameters();
...@@ -2502,6 +2526,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2502,6 +2526,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Applies SSLParameters to this socket. * Applies SSLParameters to this socket.
*/ */
@Override
synchronized public void setSSLParameters(SSLParameters params) { synchronized public void setSSLParameters(SSLParameters params) {
super.setSSLParameters(params); super.setSSLParameters(params);
...@@ -2550,6 +2575,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2550,6 +2575,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
event = e; event = e;
} }
@Override
public void run() { public void run() {
// Don't need to synchronize, as it only runs in one thread. // Don't need to synchronize, as it only runs in one thread.
for (Map.Entry<HandshakeCompletedListener,AccessControlContext> for (Map.Entry<HandshakeCompletedListener,AccessControlContext>
...@@ -2558,6 +2584,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2558,6 +2584,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
final HandshakeCompletedListener l = entry.getKey(); final HandshakeCompletedListener l = entry.getKey();
AccessControlContext acc = entry.getValue(); AccessControlContext acc = entry.getValue();
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() { public Void run() {
l.handshakeCompleted(event); l.handshakeCompleted(event);
return null; return null;
...@@ -2570,6 +2597,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { ...@@ -2570,6 +2597,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
/** /**
* Returns a printable representation of this end of the connection. * Returns a printable representation of this end of the connection.
*/ */
@Override
public String toString() { public String toString() {
StringBuffer retval = new StringBuffer(80); StringBuffer retval = new StringBuffer(80);
......
...@@ -43,7 +43,6 @@ import javax.security.auth.Subject; ...@@ -43,7 +43,6 @@ import javax.security.auth.Subject;
import sun.security.ssl.HandshakeMessage.*; import sun.security.ssl.HandshakeMessage.*;
import sun.security.ssl.CipherSuite.*; import sun.security.ssl.CipherSuite.*;
import sun.security.ssl.SignatureAndHashAlgorithm.*; import sun.security.ssl.SignatureAndHashAlgorithm.*;
import static sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.KeyExchange.*; import static sun.security.ssl.CipherSuite.KeyExchange.*;
/** /**
...@@ -144,6 +143,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -144,6 +143,7 @@ final class ServerHandshaker extends Handshaker {
* It updates the state machine as each message is processed, and writes * It updates the state machine as each message is processed, and writes
* responses as needed using the connection in the constructor. * responses as needed using the connection in the constructor.
*/ */
@Override
void processMessage(byte type, int message_len) void processMessage(byte type, int message_len)
throws IOException { throws IOException {
// //
...@@ -526,6 +526,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -526,6 +526,7 @@ final class ServerHandshaker extends Handshaker {
try { try {
subject = AccessController.doPrivileged( subject = AccessController.doPrivileged(
new PrivilegedExceptionAction<Subject>() { new PrivilegedExceptionAction<Subject>() {
@Override
public Subject run() throws Exception { public Subject run() throws Exception {
return return
Krb5Helper.getServerSubject(getAccSE()); Krb5Helper.getServerSubject(getAccSE());
...@@ -1329,6 +1330,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -1329,6 +1330,7 @@ final class ServerHandshaker extends Handshaker {
kerberosKeys = AccessController.doPrivileged( kerberosKeys = AccessController.doPrivileged(
// Eliminate dependency on KerberosKey // Eliminate dependency on KerberosKey
new PrivilegedExceptionAction<SecretKey[]>() { new PrivilegedExceptionAction<SecretKey[]>() {
@Override
public SecretKey[] run() throws Exception { public SecretKey[] run() throws Exception {
// get kerberos key for the default principal // get kerberos key for the default principal
return Krb5Helper.getServerKeys(acc); return Krb5Helper.getServerKeys(acc);
...@@ -1600,6 +1602,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -1600,6 +1602,7 @@ final class ServerHandshaker extends Handshaker {
/* /*
* Returns a HelloRequest message to kickstart renegotiations * Returns a HelloRequest message to kickstart renegotiations
*/ */
@Override
HandshakeMessage getKickstartMessage() { HandshakeMessage getKickstartMessage() {
return new HelloRequest(); return new HelloRequest();
} }
...@@ -1608,6 +1611,7 @@ final class ServerHandshaker extends Handshaker { ...@@ -1608,6 +1611,7 @@ final class ServerHandshaker extends Handshaker {
/* /*
* Fault detected during handshake. * Fault detected during handshake.
*/ */
@Override
void handshakeAlert(byte description) throws SSLProtocolException { void handshakeAlert(byte description) throws SSLProtocolException {
String message = Alerts.alertDescription(description); String message = Alerts.alertDescription(description);
......
...@@ -243,10 +243,12 @@ final class ServerNameExtension extends HelloExtension { ...@@ -243,10 +243,12 @@ final class ServerNameExtension extends HelloExtension {
return false; return false;
} }
@Override
int length() { int length() {
return listLength == 0 ? 4 : 6 + listLength; return listLength == 0 ? 4 : 6 + listLength;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id); s.putInt16(type.id);
if (listLength == 0) { if (listLength == 0) {
...@@ -262,6 +264,7 @@ final class ServerNameExtension extends HelloExtension { ...@@ -262,6 +264,7 @@ final class ServerNameExtension extends HelloExtension {
} }
} }
@Override
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
for (SNIServerName sniName : sniMap.values()) { for (SNIServerName sniName : sniMap.values()) {
......
...@@ -68,6 +68,7 @@ class SessionId ...@@ -68,6 +68,7 @@ class SessionId
} }
/** Returns the ID as a string */ /** Returns the ID as a string */
@Override
public String toString () public String toString ()
{ {
int len = sessionId.length; int len = sessionId.length;
...@@ -85,6 +86,7 @@ class SessionId ...@@ -85,6 +86,7 @@ class SessionId
/** Returns a value which is the same for session IDs which are equal */ /** Returns a value which is the same for session IDs which are equal */
@Override
public int hashCode () public int hashCode ()
{ {
int retval = 0; int retval = 0;
...@@ -95,6 +97,7 @@ class SessionId ...@@ -95,6 +97,7 @@ class SessionId
} }
/** Returns true if the parameter is the same session ID */ /** Returns true if the parameter is the same session ID */
@Override
public boolean equals (Object obj) public boolean equals (Object obj)
{ {
if (!(obj instanceof SessionId)) if (!(obj instanceof SessionId))
......
...@@ -148,6 +148,7 @@ public abstract class SunJSSE extends java.security.Provider { ...@@ -148,6 +148,7 @@ public abstract class SunJSSE extends java.security.Provider {
private void registerAlgorithms(final boolean isfips) { private void registerAlgorithms(final boolean isfips) {
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
doRegister(isfips); doRegister(isfips);
return null; return null;
......
...@@ -166,6 +166,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -166,6 +166,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* @return the certificate chain (ordered with the user's certificate first * @return the certificate chain (ordered with the user's certificate first
* and the root certificate authority last) * and the root certificate authority last)
*/ */
@Override
public X509Certificate[] getCertificateChain(String alias) { public X509Certificate[] getCertificateChain(String alias) {
if (alias == null) { if (alias == null) {
return null; return null;
...@@ -181,6 +182,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -181,6 +182,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
/* /*
* Returns the key associated with the given alias * Returns the key associated with the given alias
*/ */
@Override
public PrivateKey getPrivateKey(String alias) { public PrivateKey getPrivateKey(String alias) {
if (alias == null) { if (alias == null) {
return null; return null;
...@@ -198,6 +200,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -198,6 +200,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseClientAlias(String[] keyTypes, Principal[] issuers, public String chooseClientAlias(String[] keyTypes, Principal[] issuers,
Socket socket) { Socket socket) {
/* /*
...@@ -228,6 +231,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -228,6 +231,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* *
* @since 1.5 * @since 1.5
*/ */
@Override
public String chooseEngineClientAlias(String[] keyType, public String chooseEngineClientAlias(String[] keyType,
Principal[] issuers, SSLEngine engine) { Principal[] issuers, SSLEngine engine) {
/* /*
...@@ -242,6 +246,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -242,6 +246,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String chooseServerAlias(String keyType, public String chooseServerAlias(String keyType,
Principal[] issuers, Socket socket) { Principal[] issuers, Socket socket) {
/* /*
...@@ -283,6 +288,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -283,6 +288,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* *
* @since 1.5 * @since 1.5
*/ */
@Override
public String chooseEngineServerAlias(String keyType, public String chooseEngineServerAlias(String keyType,
Principal[] issuers, SSLEngine engine) { Principal[] issuers, SSLEngine engine) {
/* /*
...@@ -297,6 +303,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -297,6 +303,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String[] getClientAliases(String keyType, Principal[] issuers) { public String[] getClientAliases(String keyType, Principal[] issuers) {
return getAliases(keyType, issuers); return getAliases(keyType, issuers);
} }
...@@ -306,6 +313,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager { ...@@ -306,6 +313,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
* socket given the public key type and the list of * socket given the public key type and the list of
* certificate issuer authorities recognized by the peer (if any). * certificate issuer authorities recognized by the peer (if any).
*/ */
@Override
public String[] getServerAliases(String keyType, Principal[] issuers) { public String[] getServerAliases(String keyType, Principal[] issuers) {
return getAliases(keyType, issuers); return getAliases(keyType, issuers);
} }
......
...@@ -94,10 +94,12 @@ final class SupportedEllipticCurvesExtension extends HelloExtension { ...@@ -94,10 +94,12 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
return curveIds; return curveIds;
} }
@Override
int length() { int length() {
return 6 + (curveIds.length << 1); return 6 + (curveIds.length << 1);
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id); s.putInt16(type.id);
int k = curveIds.length << 1; int k = curveIds.length << 1;
...@@ -108,6 +110,7 @@ final class SupportedEllipticCurvesExtension extends HelloExtension { ...@@ -108,6 +110,7 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
} }
} }
@Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Extension " + type + ", curve names: {"); sb.append("Extension " + type + ", curve names: {");
......
...@@ -67,10 +67,12 @@ final class SupportedEllipticPointFormatsExtension extends HelloExtension { ...@@ -67,10 +67,12 @@ final class SupportedEllipticPointFormatsExtension extends HelloExtension {
} }
} }
@Override
int length() { int length() {
return 5 + formats.length; return 5 + formats.length;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id); s.putInt16(type.id);
s.putInt16(formats.length + 1); s.putInt16(formats.length + 1);
...@@ -91,6 +93,7 @@ final class SupportedEllipticPointFormatsExtension extends HelloExtension { ...@@ -91,6 +93,7 @@ final class SupportedEllipticPointFormatsExtension extends HelloExtension {
} }
} }
@Override
public String toString() { public String toString() {
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for (byte format : formats) { for (byte format : formats) {
......
...@@ -27,11 +27,9 @@ package sun.security.ssl; ...@@ -27,11 +27,9 @@ package sun.security.ssl;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import java.math.*;
import java.security.*; import java.security.*;
import java.security.cert.*; import java.security.cert.*;
import javax.net.ssl.*; import javax.net.ssl.*;
import java.security.spec.AlgorithmParameterSpec;
import sun.security.validator.Validator; import sun.security.validator.Validator;
...@@ -45,6 +43,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -45,6 +43,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
// empty // empty
} }
@Override
protected void engineInit(KeyStore ks) throws KeyStoreException { protected void engineInit(KeyStore ks) throws KeyStoreException {
if (ks == null) { if (ks == null) {
try { try {
...@@ -85,6 +84,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -85,6 +84,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
abstract X509TrustManager getInstance(ManagerFactoryParameters spec) abstract X509TrustManager getInstance(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException; throws InvalidAlgorithmParameterException;
@Override
protected void engineInit(ManagerFactoryParameters spec) throws protected void engineInit(ManagerFactoryParameters spec) throws
InvalidAlgorithmParameterException { InvalidAlgorithmParameterException {
trustManager = getInstance(spec); trustManager = getInstance(spec);
...@@ -94,6 +94,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -94,6 +94,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
/** /**
* Returns one trust manager for each type of trust material. * Returns one trust manager for each type of trust material.
*/ */
@Override
protected TrustManager[] engineGetTrustManagers() { protected TrustManager[] engineGetTrustManagers() {
if (!isInitialized) { if (!isInitialized) {
throw new IllegalStateException( throw new IllegalStateException(
...@@ -109,6 +110,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -109,6 +110,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
throws Exception { throws Exception {
return AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedExceptionAction<FileInputStream>() { new PrivilegedExceptionAction<FileInputStream>() {
@Override
public FileInputStream run() throws Exception { public FileInputStream run() throws Exception {
try { try {
if (file.exists()) { if (file.exists()) {
...@@ -139,6 +141,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -139,6 +141,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
KeyStore ks = null; KeyStore ks = null;
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception { public Void run() throws Exception {
props.put("trustStore", System.getProperty( props.put("trustStore", System.getProperty(
"javax.net.ssl.trustStore")); "javax.net.ssl.trustStore"));
...@@ -239,9 +242,11 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -239,9 +242,11 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
} }
public static final class SimpleFactory extends TrustManagerFactoryImpl { public static final class SimpleFactory extends TrustManagerFactoryImpl {
@Override
X509TrustManager getInstance(KeyStore ks) throws KeyStoreException { X509TrustManager getInstance(KeyStore ks) throws KeyStoreException {
return new X509TrustManagerImpl(Validator.TYPE_SIMPLE, ks); return new X509TrustManagerImpl(Validator.TYPE_SIMPLE, ks);
} }
@Override
X509TrustManager getInstance(ManagerFactoryParameters spec) X509TrustManager getInstance(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
throw new InvalidAlgorithmParameterException throw new InvalidAlgorithmParameterException
...@@ -251,9 +256,11 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { ...@@ -251,9 +256,11 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
} }
public static final class PKIXFactory extends TrustManagerFactoryImpl { public static final class PKIXFactory extends TrustManagerFactoryImpl {
@Override
X509TrustManager getInstance(KeyStore ks) throws KeyStoreException { X509TrustManager getInstance(KeyStore ks) throws KeyStoreException {
return new X509TrustManagerImpl(Validator.TYPE_PKIX, ks); return new X509TrustManagerImpl(Validator.TYPE_PKIX, ks);
} }
@Override
X509TrustManager getInstance(ManagerFactoryParameters spec) X509TrustManager getInstance(ManagerFactoryParameters spec)
throws InvalidAlgorithmParameterException { throws InvalidAlgorithmParameterException {
if (spec instanceof CertPathTrustManagerParameters == false) { if (spec instanceof CertPathTrustManagerParameters == false) {
......
...@@ -41,15 +41,18 @@ final class UnknownExtension extends HelloExtension { ...@@ -41,15 +41,18 @@ final class UnknownExtension extends HelloExtension {
} }
} }
@Override
int length() { int length() {
return 4 + data.length; return 4 + data.length;
} }
@Override
void send(HandshakeOutStream s) throws IOException { void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id); s.putInt16(type.id);
s.putBytes16(data); s.putBytes16(data);
} }
@Override
public String toString() { public String toString() {
return "Unsupported extension " + type + ", data: " + return "Unsupported extension " + type + ", data: " +
Debug.toString(data); Debug.toString(data);
......
...@@ -102,29 +102,34 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager ...@@ -102,29 +102,34 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
// public methods // public methods
// //
@Override
public X509Certificate[] getCertificateChain(String alias) { public X509Certificate[] getCertificateChain(String alias) {
PrivateKeyEntry entry = getEntry(alias); PrivateKeyEntry entry = getEntry(alias);
return entry == null ? null : return entry == null ? null :
(X509Certificate[])entry.getCertificateChain(); (X509Certificate[])entry.getCertificateChain();
} }
@Override
public PrivateKey getPrivateKey(String alias) { public PrivateKey getPrivateKey(String alias) {
PrivateKeyEntry entry = getEntry(alias); PrivateKeyEntry entry = getEntry(alias);
return entry == null ? null : entry.getPrivateKey(); return entry == null ? null : entry.getPrivateKey();
} }
@Override
public String chooseClientAlias(String[] keyTypes, Principal[] issuers, public String chooseClientAlias(String[] keyTypes, Principal[] issuers,
Socket socket) { Socket socket) {
return chooseAlias(getKeyTypes(keyTypes), issuers, CheckType.CLIENT, return chooseAlias(getKeyTypes(keyTypes), issuers, CheckType.CLIENT,
getAlgorithmConstraints(socket)); getAlgorithmConstraints(socket));
} }
@Override
public String chooseEngineClientAlias(String[] keyTypes, public String chooseEngineClientAlias(String[] keyTypes,
Principal[] issuers, SSLEngine engine) { Principal[] issuers, SSLEngine engine) {
return chooseAlias(getKeyTypes(keyTypes), issuers, CheckType.CLIENT, return chooseAlias(getKeyTypes(keyTypes), issuers, CheckType.CLIENT,
getAlgorithmConstraints(engine)); getAlgorithmConstraints(engine));
} }
@Override
public String chooseServerAlias(String keyType, public String chooseServerAlias(String keyType,
Principal[] issuers, Socket socket) { Principal[] issuers, Socket socket) {
return chooseAlias(getKeyTypes(keyType), issuers, CheckType.SERVER, return chooseAlias(getKeyTypes(keyType), issuers, CheckType.SERVER,
...@@ -142,6 +147,7 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager ...@@ -142,6 +147,7 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
// It is not a really HTTPS endpoint identification. // It is not a really HTTPS endpoint identification.
} }
@Override
public String chooseEngineServerAlias(String keyType, public String chooseEngineServerAlias(String keyType,
Principal[] issuers, SSLEngine engine) { Principal[] issuers, SSLEngine engine) {
return chooseAlias(getKeyTypes(keyType), issuers, CheckType.SERVER, return chooseAlias(getKeyTypes(keyType), issuers, CheckType.SERVER,
...@@ -159,10 +165,12 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager ...@@ -159,10 +165,12 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
// It is not a really HTTPS endpoint identification. // It is not a really HTTPS endpoint identification.
} }
@Override
public String[] getClientAliases(String keyType, Principal[] issuers) { public String[] getClientAliases(String keyType, Principal[] issuers) {
return getAliases(keyType, issuers, CheckType.CLIENT, null); return getAliases(keyType, issuers, CheckType.CLIENT, null);
} }
@Override
public String[] getServerAliases(String keyType, Principal[] issuers) { public String[] getServerAliases(String keyType, Principal[] issuers) {
return getAliases(keyType, issuers, CheckType.SERVER, null); return getAliases(keyType, issuers, CheckType.SERVER, null);
} }
...@@ -488,11 +496,13 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager ...@@ -488,11 +496,13 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
this.checkResult = checkResult; this.checkResult = checkResult;
} }
@Override
public int compareTo(EntryStatus other) { public int compareTo(EntryStatus other) {
int result = this.checkResult.compareTo(other.checkResult); int result = this.checkResult.compareTo(other.checkResult);
return (result == 0) ? (this.keyIndex - other.keyIndex) : result; return (result == 0) ? (this.keyIndex - other.keyIndex) : result;
} }
@Override
public String toString() { public String toString() {
String s = alias + " (verified: " + checkResult + ")"; String s = alias + " (verified: " + checkResult + ")";
if (builderIndex == 0) { if (builderIndex == 0) {
......
...@@ -28,7 +28,6 @@ package sun.security.ssl; ...@@ -28,7 +28,6 @@ package sun.security.ssl;
import java.net.Socket; import java.net.Socket;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.security.*; import java.security.*;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册