Changeset 143 for trunk/vnc/vnc_javasrc


Ignore:
Timestamp:
Oct 8, 2007, 4:35:12 AM (17 years ago)
Author:
quentin
Message:

SSL support for VNC proxy

Location:
trunk/vnc/vnc_javasrc
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/vnc/vnc_javasrc/Makefile

    r105 r143  
    2020          VNCProxyConnectSocketFactory.class VNCProxyConnectSocket.class \
    2121          HTTPConnectSocket.class ReloginPanel.class \
    22           InStream.class MemInStream.class ZlibInStream.class
     22          InStream.class MemInStream.class ZlibInStream.class \
     23          VNCProxyConnectSocketWrapper.class SocketWrapper.class SocketWrapper\$$WrappingSocketImpl.class SIPBTrustManager.class
    2324
    2425SOURCES = VncViewer.java RfbProto.java AuthPanel.java VncCanvas.java \
     
    3031          VNCProxyConnectSocketFactory.java VNCProxyConnectSocket.java \
    3132          HTTPConnectSocket.java ReloginPanel.java \
    32           InStream.java MemInStream.java ZlibInStream.java
     33          InStream.java MemInStream.java ZlibInStream.java \
     34          VNCProxyConnectSocketWrapper.java SocketWrapper.java SIPBTrustManager.java
     35
     36EXTRAJAR = trust.store
    3337
    3438all: $(CLASSES) $(ARCHIVE)
     
    3842
    3943$(ARCHIVE): $(CLASSES) $(MANIFEST)
    40         $(JAR) cfm $(ARCHIVE) $(MANIFEST) $(CLASSES)
     44        $(JAR) cfm $(ARCHIVE) $(MANIFEST) $(CLASSES) $(EXTRAJAR)
    4145
    4246install: $(CLASSES) $(ARCHIVE)
  • trunk/vnc/vnc_javasrc/VNCProxyConnectSocketFactory.java

    r66 r143  
    2727import java.applet.*;
    2828import java.net.*;
     29import javax.net.ssl.*;
    2930import java.io.*;
    3031
    3132class VNCProxyConnectSocketFactory implements SocketFactory {
     33
     34    SSLSocketFactory factory;
     35   
     36    public VNCProxyConnectSocketFactory() {
     37        try {
     38            SSLContext c = SSLContext.getInstance("SSL");
     39            c.init(null,
     40                   new TrustManager[] { new SIPBTrustManager() },
     41                   null);
     42            factory =
     43                (SSLSocketFactory)c.getSocketFactory();
     44        } catch (Exception e) {
     45            e.printStackTrace();
     46        }
     47    }
    3248
    3349  public Socket createSocket(String host, int port, Applet applet)
     
    5874    System.out.println("VNCProxy CONNECT via proxy " + host +
    5975                       " port " + port + " to vm " + vmname);
    60     VNCProxyConnectSocket s =
    61       new VNCProxyConnectSocket(host, port, vmname, authtoken);
     76    SSLSocket ssls = (SSLSocket)factory.createSocket(host, port);
     77    ssls.startHandshake();
     78    VNCProxyConnectSocketWrapper s =
     79      new VNCProxyConnectSocketWrapper(ssls, vmname, authtoken);
    6280
    6381    return (Socket)s;
Note: See TracChangeset for help on using the changeset viewer.