summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-10-21 17:02:37 +0200
committerBenoit Foucher <benoit@zeroc.com>2009-10-21 17:02:37 +0200
commita80b3c8cbb203c78b061e99e1a764685af4a93e9 (patch)
tree5448b1dd66499b8fc9e46c618aa65b6687855946 /java/src
parentBug 4311 - change Ice::Service::start signature (diff)
downloadice-a80b3c8cbb203c78b061e99e1a764685af4a93e9.tar.bz2
ice-a80b3c8cbb203c78b061e99e1a764685af4a93e9.tar.xz
ice-a80b3c8cbb203c78b061e99e1a764685af4a93e9.zip
- Removed old IceSSL::ConnectionInfo struct, it's now replaced with
IceSSL::NativeConnectionInfo. - Removed Ice::ConnectionInfo endpoint attribute. - Added Ice::Connection::getEndpoint() method. - Added Ice::ConnectionInfo adapterName and incoming attributes. - Replaced Tcp and Udp prefixes with TCP and UDP in endpoint/info classes. - Added IPEndpointInfo and IPConnectionInfo intermediate classes. - Fixed 2058: deprecate ice_hash for Ice.Object & Ice.LocalObject, added ice_getHash - Fixed bug where Ice::Endpoint comparison would only compare the endpoint object addresses rather than the endpoint attributes like in Java and C#. - Added ice_getHash implementation for endpoints and cleaned up Reference::hash to use HashUtil.h helper methods. - Added test/Ice/info and removed endpoint info test from test/Ice/proxy.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/ConnectionI.java21
-rw-r--r--java/src/IceInternal/TcpConnector.java2
-rw-r--r--java/src/IceInternal/TcpEndpointFactory.java2
-rw-r--r--java/src/IceInternal/TcpEndpointI.java10
-rw-r--r--java/src/IceInternal/TcpTransceiver.java2
-rw-r--r--java/src/IceInternal/UdpConnector.java2
-rw-r--r--java/src/IceInternal/UdpEndpointFactory.java2
-rw-r--r--java/src/IceInternal/UdpEndpointI.java10
-rw-r--r--java/src/IceInternal/UdpTransceiver.java2
-rw-r--r--java/src/IceSSL/CertificateVerifier.java2
-rw-r--r--java/src/IceSSL/ConnectionInfo.java52
-rw-r--r--java/src/IceSSL/ConnectionInvalidException.java49
-rw-r--r--java/src/IceSSL/ConnectorI.java2
-rw-r--r--java/src/IceSSL/EndpointFactoryI.java2
-rw-r--r--java/src/IceSSL/EndpointI.java10
-rw-r--r--java/src/IceSSL/Instance.java16
-rw-r--r--java/src/IceSSL/NativeConnectionInfo.java28
-rw-r--r--java/src/IceSSL/TransceiverI.java102
-rw-r--r--java/src/IceSSL/TrustManager.java14
-rw-r--r--java/src/IceSSL/Util.java55
20 files changed, 123 insertions, 262 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index da2b0b1aab6..7fb693abf3c 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -832,6 +832,12 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
return _adapter;
}
+ public Endpoint
+ getEndpoint()
+ {
+ return _endpoint; // No mutex protection necessary, _endpoint is immutable.
+ }
+
public ObjectPrx
createProxy(Identity ident)
{
@@ -1203,22 +1209,11 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
throw (Ice.LocalException)_exception.fillInStackTrace();
}
ConnectionInfo info = _transceiver.getInfo();
- info.endpoint = _endpoint.getInfo();
+ info.adapterName = _adapter != null ? _adapter.getName() : "";
+ info.incoming = _connector == null;
return info;
}
- //
- // Only used by the SSL plug-in.
- //
- // The external party has to synchronize the connection, since the
- // connection is the object that protects the transceiver.
- //
- public IceInternal.Transceiver
- getTransceiver()
- {
- return _transceiver;
- }
-
public String
_toString()
{
diff --git a/java/src/IceInternal/TcpConnector.java b/java/src/IceInternal/TcpConnector.java
index ae5d618be99..cadc4335ffc 100644
--- a/java/src/IceInternal/TcpConnector.java
+++ b/java/src/IceInternal/TcpConnector.java
@@ -50,7 +50,7 @@ final class TcpConnector implements Connector
public short
type()
{
- return TcpEndpointI.TYPE;
+ return Ice.TCPEndpointType.value;
}
public String
diff --git a/java/src/IceInternal/TcpEndpointFactory.java b/java/src/IceInternal/TcpEndpointFactory.java
index 25bdfdb557a..48952c04e89 100644
--- a/java/src/IceInternal/TcpEndpointFactory.java
+++ b/java/src/IceInternal/TcpEndpointFactory.java
@@ -19,7 +19,7 @@ final class TcpEndpointFactory implements EndpointFactory
public short
type()
{
- return TcpEndpointI.TYPE;
+ return Ice.TCPEndpointType.value;
}
public String
diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java
index 44fc624af8d..27618d8ccc5 100644
--- a/java/src/IceInternal/TcpEndpointI.java
+++ b/java/src/IceInternal/TcpEndpointI.java
@@ -11,8 +11,6 @@ package IceInternal;
final class TcpEndpointI extends EndpointI
{
- final static short TYPE = 1;
-
public
TcpEndpointI(Instance instance, String ho, int po, int ti, String conId, boolean co)
{
@@ -178,7 +176,7 @@ final class TcpEndpointI extends EndpointI
public void
streamWrite(BasicStream s)
{
- s.writeShort(TYPE);
+ s.writeShort(Ice.TCPEndpointType.value);
s.startWriteEncaps();
s.writeString(_host);
s.writeInt(_port);
@@ -236,11 +234,11 @@ final class TcpEndpointI extends EndpointI
public Ice.EndpointInfo
getInfo()
{
- return new Ice.TcpEndpointInfo(_timeout, _compress, _host, _port)
+ return new Ice.TCPEndpointInfo(_timeout, _compress, _host, _port)
{
public short type()
{
- return TYPE;
+ return Ice.TCPEndpointType.value;
}
public boolean datagram()
@@ -261,7 +259,7 @@ final class TcpEndpointI extends EndpointI
public short
type()
{
- return TYPE;
+ return Ice.TCPEndpointType.value;
}
//
diff --git a/java/src/IceInternal/TcpTransceiver.java b/java/src/IceInternal/TcpTransceiver.java
index fef0558e62c..cd4e325772e 100644
--- a/java/src/IceInternal/TcpTransceiver.java
+++ b/java/src/IceInternal/TcpTransceiver.java
@@ -225,7 +225,7 @@ final class TcpTransceiver implements Transceiver
getInfo()
{
assert(_fd != null);
- Ice.TcpConnectionInfo info = new Ice.TcpConnectionInfo();
+ Ice.TCPConnectionInfo info = new Ice.TCPConnectionInfo();
java.net.Socket socket = _fd.socket();
info.localAddress = socket.getLocalAddress().getHostAddress();
info.localPort = socket.getLocalPort();
diff --git a/java/src/IceInternal/UdpConnector.java b/java/src/IceInternal/UdpConnector.java
index edff81e92a2..f8f5c651ed9 100644
--- a/java/src/IceInternal/UdpConnector.java
+++ b/java/src/IceInternal/UdpConnector.java
@@ -27,7 +27,7 @@ final class UdpConnector implements Connector
public short
type()
{
- return UdpEndpointI.TYPE;
+ return Ice.UDPEndpointType.value;
}
public String
diff --git a/java/src/IceInternal/UdpEndpointFactory.java b/java/src/IceInternal/UdpEndpointFactory.java
index a92b443b1d8..1f08169199b 100644
--- a/java/src/IceInternal/UdpEndpointFactory.java
+++ b/java/src/IceInternal/UdpEndpointFactory.java
@@ -19,7 +19,7 @@ final class UdpEndpointFactory implements EndpointFactory
public short
type()
{
- return UdpEndpointI.TYPE;
+ return Ice.UDPEndpointType.value;
}
public String
diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java
index 846b4f41c48..880eae25473 100644
--- a/java/src/IceInternal/UdpEndpointI.java
+++ b/java/src/IceInternal/UdpEndpointI.java
@@ -11,8 +11,6 @@ package IceInternal;
final class UdpEndpointI extends EndpointI
{
- final static short TYPE = 3;
-
public
UdpEndpointI(Instance instance, String ho, int po, String mif, int mttl, byte pma, byte pmi, byte ema, byte emi,
boolean conn, String conId, boolean co)
@@ -315,7 +313,7 @@ final class UdpEndpointI extends EndpointI
public void
streamWrite(BasicStream s)
{
- s.writeShort(TYPE);
+ s.writeShort(Ice.UDPEndpointType.value);
s.startWriteEncaps();
s.writeString(_host);
s.writeInt(_port);
@@ -402,12 +400,12 @@ final class UdpEndpointI extends EndpointI
public Ice.EndpointInfo
getInfo()
{
- return new Ice.UdpEndpointInfo(-1, _compress, _host, _port, _protocolMajor, _protocolMinor, _encodingMajor,
+ return new Ice.UDPEndpointInfo(-1, _compress, _host, _port, _protocolMajor, _protocolMinor, _encodingMajor,
_encodingMinor, _mcastInterface, _mcastTtl)
{
public short type()
{
- return TYPE;
+ return Ice.UDPEndpointType.value;
}
public boolean datagram()
@@ -428,7 +426,7 @@ final class UdpEndpointI extends EndpointI
public short
type()
{
- return TYPE;
+ return Ice.UDPEndpointType.value;
}
//
diff --git a/java/src/IceInternal/UdpTransceiver.java b/java/src/IceInternal/UdpTransceiver.java
index 10f4c531935..bd18ad77678 100644
--- a/java/src/IceInternal/UdpTransceiver.java
+++ b/java/src/IceInternal/UdpTransceiver.java
@@ -234,7 +234,7 @@ final class UdpTransceiver implements Transceiver
{
assert(_fd != null);
- Ice.UdpConnectionInfo info = new Ice.UdpConnectionInfo();
+ Ice.UDPConnectionInfo info = new Ice.UDPConnectionInfo();
java.net.DatagramSocket socket = _fd.socket();
info.localAddress = socket.getLocalAddress().getHostAddress();
info.localPort = socket.getLocalPort();
diff --git a/java/src/IceSSL/CertificateVerifier.java b/java/src/IceSSL/CertificateVerifier.java
index eae8cd936e5..b9e52fca064 100644
--- a/java/src/IceSSL/CertificateVerifier.java
+++ b/java/src/IceSSL/CertificateVerifier.java
@@ -22,5 +22,5 @@ public interface CertificateVerifier
* @return <code>true</code> if the connection should be accepted;
* <code>false</code>, otherwise.
**/
- boolean verify(ConnectionInfo info);
+ boolean verify(NativeConnectionInfo info);
}
diff --git a/java/src/IceSSL/ConnectionInfo.java b/java/src/IceSSL/ConnectionInfo.java
deleted file mode 100644
index 7f086722200..00000000000
--- a/java/src/IceSSL/ConnectionInfo.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceSSL;
-
-/**
- * This class provides information about a connection to applications
- * that require information about a peer, for example, to implement
- * a CertificateVerifier.
- *
- * @see CertificateVerifier
- **/
-public class ConnectionInfo
-{
- /**
- * The certificate chain. This may be null if the peer did not
- * supply a certificate. The peer's certificate (if any) is the
- * first one in the chain.
- **/
- public java.security.cert.Certificate[] certs;
-
- /**
- * The name of the negotiated cipher.
- **/
- public String cipher;
-
- /**
- * The local TCP/IP host & port.
- **/
- public java.net.InetSocketAddress localAddr;
-
- /**
- * The remote TCP/IP host & port.
- **/
- public java.net.InetSocketAddress remoteAddr;
-
- /**
- * <code>true</code> if the connection is incoming; <code>false</code> otherwise.
- **/
- public boolean incoming;
-
- /**
- * The name of the object adapter that hosts this endpoint, if any.
- **/
- public String adapterName;
-}
diff --git a/java/src/IceSSL/ConnectionInvalidException.java b/java/src/IceSSL/ConnectionInvalidException.java
deleted file mode 100644
index 67751a6ea76..00000000000
--- a/java/src/IceSSL/ConnectionInvalidException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceSSL;
-
-/**
- * Indicates that a connection is not an SSL connection.
- **/
-public final class ConnectionInvalidException extends Ice.LocalException
-{
- /**
- * Creates an instance with a <code>null</code> <code>reason</code> field.
- **/
- public ConnectionInvalidException()
- {
- }
-
- /**
- * Creates an instance with the specified <code>reason</code>field.
- *
- * @param reason The reason why the connection is considered invalid.
- **/
- public ConnectionInvalidException(String reason)
- {
- this.reason = reason;
- }
-
- /**
- * Returns the name of this exception.
- *
- * @return Returns <code>"Ice::ConnectionInvalidException"</code>.
- **/
- public String
- ice_name()
- {
- return "Ice::ConnectionInvalidException";
- }
-
- /**
- * The reason why the connection is considered invalid.
- **/
- public String reason;
-}
diff --git a/java/src/IceSSL/ConnectorI.java b/java/src/IceSSL/ConnectorI.java
index 32e8d4cf817..282336b19f7 100644
--- a/java/src/IceSSL/ConnectorI.java
+++ b/java/src/IceSSL/ConnectorI.java
@@ -61,7 +61,7 @@ final class ConnectorI implements IceInternal.Connector
public short
type()
{
- return EndpointI.TYPE;
+ return EndpointType.value;
}
public String
diff --git a/java/src/IceSSL/EndpointFactoryI.java b/java/src/IceSSL/EndpointFactoryI.java
index 5e380ea6a24..3219de15596 100644
--- a/java/src/IceSSL/EndpointFactoryI.java
+++ b/java/src/IceSSL/EndpointFactoryI.java
@@ -19,7 +19,7 @@ final class EndpointFactoryI implements IceInternal.EndpointFactory
public short
type()
{
- return EndpointI.TYPE;
+ return EndpointType.value;
}
public String
diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java
index 77e70e0671d..9c0282750da 100644
--- a/java/src/IceSSL/EndpointI.java
+++ b/java/src/IceSSL/EndpointI.java
@@ -11,8 +11,6 @@ package IceSSL;
final class EndpointI extends IceInternal.EndpointI
{
- final static short TYPE = 2;
-
public
EndpointI(Instance instance, String ho, int po, int ti, String conId, boolean co)
{
@@ -178,7 +176,7 @@ final class EndpointI extends IceInternal.EndpointI
public void
streamWrite(IceInternal.BasicStream s)
{
- s.writeShort(TYPE);
+ s.writeShort(EndpointType.value);
s.startWriteEncaps();
s.writeString(_host);
s.writeInt(_port);
@@ -236,11 +234,11 @@ final class EndpointI extends IceInternal.EndpointI
public Ice.EndpointInfo
getInfo()
{
- return new IceSSL.SSLEndpointInfo(_timeout, _compress, _host, _port)
+ return new IceSSL.EndpointInfo(_timeout, _compress, _host, _port)
{
public short type()
{
- return TYPE;
+ return EndpointType.value;
}
public boolean datagram()
@@ -261,7 +259,7 @@ final class EndpointI extends IceInternal.EndpointI
public short
type()
{
- return TYPE;
+ return EndpointType.value;
}
//
diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java
index ee33751ae49..866d0d62821 100644
--- a/java/src/IceSSL/Instance.java
+++ b/java/src/IceSSL/Instance.java
@@ -869,15 +869,15 @@ class Instance
}
void
- verifyPeer(ConnectionInfo info, java.nio.channels.SelectableChannel fd, String address, boolean incoming)
+ verifyPeer(NativeConnectionInfo info, java.nio.channels.SelectableChannel fd, String address)
{
//
// For an outgoing connection, we compare the proxy address (if any) against
// fields in the server's certificate (if any).
//
- if(info.certs != null && info.certs.length > 0 && address.length() > 0)
+ if(info.nativeCerts != null && info.nativeCerts.length > 0 && address.length() > 0)
{
- java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)info.certs[0];
+ java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)info.nativeCerts[0];
//
// Extract the IP addresses and the DNS names from the subject
@@ -1005,10 +1005,10 @@ class Instance
}
}
- if(_verifyDepthMax > 0 && info.certs != null && info.certs.length > _verifyDepthMax)
+ if(_verifyDepthMax > 0 && info.nativeCerts != null && info.nativeCerts.length > _verifyDepthMax)
{
- String msg = (incoming ? "incoming" : "outgoing") + " connection rejected:\n" +
- "length of peer's certificate chain (" + info.certs.length + ") exceeds maximum of " +
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected:\n" +
+ "length of peer's certificate chain (" + info.nativeCerts.length + ") exceeds maximum of " +
_verifyDepthMax + "\n" +
IceInternal.Network.fdToString(fd);
if(_securityTraceLevel >= 1)
@@ -1022,7 +1022,7 @@ class Instance
if(!_trustManager.verify(info))
{
- String msg = (incoming ? "incoming" : "outgoing") + " connection rejected by trust manager\n" +
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected by trust manager\n" +
IceInternal.Network.fdToString(fd);
if(_securityTraceLevel >= 1)
{
@@ -1035,7 +1035,7 @@ class Instance
if(_verifier != null && !_verifier.verify(info))
{
- String msg = (incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier\n" +
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier\n" +
IceInternal.Network.fdToString(fd);
if(_securityTraceLevel >= 1)
{
diff --git a/java/src/IceSSL/NativeConnectionInfo.java b/java/src/IceSSL/NativeConnectionInfo.java
new file mode 100644
index 00000000000..f84705fbd69
--- /dev/null
+++ b/java/src/IceSSL/NativeConnectionInfo.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package IceSSL;
+
+/**
+ *
+ * This class is a native extension of the Slice local class
+ * IceSSL::ConnectionInfo. It provides access to the native Java
+ * certificates.
+ *
+ * @see CertificateVerifier
+ **/
+public class NativeConnectionInfo extends ConnectionInfo
+{
+ /**
+ * The certificate chain. This may be null if the peer did not
+ * supply a certificate. The peer's certificate (if any) is the
+ * first one in the chain.
+ **/
+ public java.security.cert.Certificate[] nativeCerts;
+}
diff --git a/java/src/IceSSL/TransceiverI.java b/java/src/IceSSL/TransceiverI.java
index 54687c5f052..05af29c35a6 100644
--- a/java/src/IceSSL/TransceiverI.java
+++ b/java/src/IceSSL/TransceiverI.java
@@ -277,44 +277,7 @@ final class TransceiverI implements IceInternal.Transceiver
public Ice.ConnectionInfo
getInfo()
{
- assert(_fd != null);
-
- IceSSL.SSLConnectionInfo info = new IceSSL.SSLConnectionInfo();
- java.net.Socket socket = _fd.socket();
- info.localAddress = socket.getLocalAddress().getHostAddress();
- info.localPort = socket.getLocalPort();
- if(socket.getInetAddress() != null)
- {
- info.remoteAddress = socket.getInetAddress().getHostAddress();
- info.remotePort = socket.getPort();
- }
- else
- {
- info.remoteAddress = "";
- info.remotePort = -1;
- }
- SSLSession session = _engine.getSession();
- info.cipher = session.getCipherSuite();
- try
- {
- java.util.ArrayList<String> certs = new java.util.ArrayList<String>();
- for(java.security.cert.Certificate c : session.getPeerCertificates())
- {
- StringBuffer s = new StringBuffer("-----BEGIN CERTIFICATE-----\n");
- s.append(IceUtilInternal.Base64.encode(c.getEncoded()));
- s.append("\n-----END CERTIFICATE-----");
- certs.add(s.toString());
- }
- info.certs = certs.toArray(new String[0]);
- }
- catch(java.security.cert.CertificateEncodingException ex)
- {
- }
- catch(javax.net.ssl.SSLPeerUnverifiedException ex)
- {
- // No peer certificates.
- }
- return info;
+ return getNativeConnectionInfo();
}
public void
@@ -326,16 +289,6 @@ final class TransceiverI implements IceInternal.Transceiver
}
}
- ConnectionInfo
- getConnectionInfo()
- {
- //
- // This can only be called on an open transceiver.
- //
- assert(_fd != null);
- return _info;
- }
-
//
// Only for use by ConnectorI, AcceptorI.
//
@@ -388,6 +341,55 @@ final class TransceiverI implements IceInternal.Transceiver
super.finalize();
}
+ private NativeConnectionInfo
+ getNativeConnectionInfo()
+ {
+ //
+ // This can only be called on an open transceiver.
+ //
+ assert(_fd != null);
+
+ NativeConnectionInfo info = new NativeConnectionInfo();
+ java.net.Socket socket = _fd.socket();
+ info.localAddress = socket.getLocalAddress().getHostAddress();
+ info.localPort = socket.getLocalPort();
+ if(socket.getInetAddress() != null)
+ {
+ info.remoteAddress = socket.getInetAddress().getHostAddress();
+ info.remotePort = socket.getPort();
+ }
+ else
+ {
+ info.remoteAddress = "";
+ info.remotePort = -1;
+ }
+ SSLSession session = _engine.getSession();
+ info.cipher = session.getCipherSuite();
+ try
+ {
+ java.util.ArrayList<String> certs = new java.util.ArrayList<String>();
+ info.nativeCerts = session.getPeerCertificates();
+ for(java.security.cert.Certificate c : info.nativeCerts)
+ {
+ StringBuffer s = new StringBuffer("-----BEGIN CERTIFICATE-----\n");
+ s.append(IceUtilInternal.Base64.encode(c.getEncoded()));
+ s.append("\n-----END CERTIFICATE-----");
+ certs.add(s.toString());
+ }
+ info.certs = certs.toArray(new String[0]);
+ }
+ catch(java.security.cert.CertificateEncodingException ex)
+ {
+ }
+ catch(javax.net.ssl.SSLPeerUnverifiedException ex)
+ {
+ // No peer certificates.
+ }
+ info.adapterName = _adapterName;
+ info.incoming = _incoming;
+ return info;
+ }
+
private int
handshakeNonBlocking()
{
@@ -535,8 +537,7 @@ final class TransceiverI implements IceInternal.Transceiver
//
// Additional verification.
//
- _info = Util.populateConnectionInfo(_engine.getSession(), _fd.socket(), _adapterName, _incoming);
- _instance.verifyPeer(_info, _fd, _host, _incoming);
+ _instance.verifyPeer(getNativeConnectionInfo(), _fd, _host);
if(_instance.networkTraceLevel() >= 1)
{
@@ -805,7 +806,6 @@ final class TransceiverI implements IceInternal.Transceiver
private ByteBuffer _netInput; // Holds encrypted data read from the socket.
private ByteBuffer _netOutput; // Holds encrypted data to be written to the socket.
private static ByteBuffer _emptyBuffer = ByteBuffer.allocate(0); // Used during handshaking.
- private ConnectionInfo _info;
private static final int StateNeedConnect = 0;
private static final int StateConnectPending = 1;
diff --git a/java/src/IceSSL/TrustManager.java b/java/src/IceSSL/TrustManager.java
index b54b18d16e9..46fdc3eabb5 100644
--- a/java/src/IceSSL/TrustManager.java
+++ b/java/src/IceSSL/TrustManager.java
@@ -55,7 +55,7 @@ class TrustManager
}
boolean
- verify(ConnectionInfo info)
+ verify(NativeConnectionInfo info)
{
java.util.List<java.util.List<java.util.List<RFC2253.RDNPair> > >
reject = new java.util.LinkedList<java.util.List<java.util.List<RFC2253.RDNPair> > >(),
@@ -126,10 +126,10 @@ class TrustManager
//
// If there is no certificate then we match false.
//
- if(info.certs != null && info.certs.length > 0)
+ if(info.nativeCerts != null && info.nativeCerts.length > 0)
{
javax.security.auth.x500.X500Principal subjectDN = (javax.security.auth.x500.X500Principal)
- ((java.security.cert.X509Certificate)info.certs[0]).getSubjectX500Principal();
+ ((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectX500Principal();
String subjectName = subjectDN.getName(javax.security.auth.x500.X500Principal.RFC2253);
assert subjectName != null;
try
@@ -144,15 +144,15 @@ class TrustManager
_communicator.getLogger().trace("Security", "trust manager evaluating client:\n" +
"subject = " + subjectName + "\n" +
"adapter = " + info.adapterName + "\n" +
- "local addr = " + IceInternal.Network.addrToString(info.localAddr) + "\n" +
- "remote addr = " + IceInternal.Network.addrToString(info.remoteAddr));
+ "local addr = " + info.localAddress + ":" + info.localPort + "\n" +
+ "remote addr = " + info.remoteAddress + ":" + info.remotePort);
}
else
{
_communicator.getLogger().trace("Security", "trust manager evaluating server:\n" +
"subject = " + subjectName + "\n" +
- "local addr = " + IceInternal.Network.addrToString(info.localAddr) + "\n" +
- "remote addr = " + IceInternal.Network.addrToString(info.remoteAddr));
+ "local addr = " + info.localAddress + ":" + info.localPort + "\n" +
+ "remote addr = " + info.remoteAddress + ":" + info.remotePort);
}
}
java.util.List<RFC2253.RDNPair> dn = RFC2253.parseStrict(subjectName);
diff --git a/java/src/IceSSL/Util.java b/java/src/IceSSL/Util.java
index ae3e5ced65f..05e3f5613a2 100644
--- a/java/src/IceSSL/Util.java
+++ b/java/src/IceSSL/Util.java
@@ -11,41 +11,6 @@ package IceSSL;
public final class Util
{
- public static ConnectionInfo
- getConnectionInfo(Ice.Connection connection)
- {
- Ice.ConnectionI con = (Ice.ConnectionI)connection;
- assert(con != null);
-
- //
- // Lock the connection directly. This is done because the only
- // thing that prevents the transceiver from being closed during
- // the duration of the invocation is the connection.
- //
- synchronized(con)
- {
- IceInternal.Transceiver transceiver = con.getTransceiver();
- if(transceiver == null)
- {
- ConnectionInvalidException ex = new ConnectionInvalidException();
- ex.reason = "connection closed";
- throw ex;
- }
-
- try
- {
- TransceiverI sslTransceiver = (TransceiverI)transceiver;
- return sslTransceiver.getConnectionInfo();
- }
- catch(ClassCastException ex)
- {
- ConnectionInvalidException e = new ConnectionInvalidException();
- e.reason = "not ssl connection";
- throw e;
- }
- }
- }
-
//
// Create a certificate from a PEM-encoded string.
//
@@ -94,26 +59,6 @@ public final class Util
return (java.security.cert.X509Certificate)cf.generateCertificate(in);
}
- static ConnectionInfo
- populateConnectionInfo(javax.net.ssl.SSLSession session, java.net.Socket fd, String adapterName, boolean incoming)
- {
- ConnectionInfo info = new ConnectionInfo();
- try
- {
- info.certs = session.getPeerCertificates();
- }
- catch(javax.net.ssl.SSLPeerUnverifiedException ex)
- {
- // No peer certificates.
- }
- info.cipher = session.getCipherSuite();
- info.localAddr = (java.net.InetSocketAddress)fd.getLocalSocketAddress();
- info.remoteAddr = (java.net.InetSocketAddress)fd.getRemoteSocketAddress();
- info.adapterName = adapterName;
- info.incoming = incoming;
- return info;
- }
-
public final static String jdkTarget = "1.5";
//