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