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

SSL support for VNC proxy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.