001: ///////////////////////////////////////////////////////////////////////////////
002: //
003: // This program is free software; you can redistribute it and/or modify
004: // it under the terms of the GNU General Public License and GNU Library
005: // General Public License as published by the Free Software Foundation;
006: // either version 2, or (at your option) any later version.
007: //
008: // This program is distributed in the hope that it will be useful,
009: // but WITHOUT ANY WARRANTY; without even the implied warranty of
010: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: // GNU General Public License and GNU Library General Public License
012: // for more details.
013: //
014: // You should have received a copy of the GNU General Public License
015: // and GNU Library General Public License along with this program; if
016: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
017: // MA 02139, USA.
018: //
019: ///////////////////////////////////////////////////////////////////////////////
020:
021: package org.rdesktop.server.rdp;
022:
023: import java.io.*;
024: import java.net.*;
025:
026: public class RdpISO extends RdpAbstractISO {
027: public RdpISO(RdpProto rdpProto) {
028: super (rdpProto);
029: }
030:
031: /*
032: protected Socket negotiateSSL(Socket sock) throws Exception
033: {
034: // The default host/port to connect to
035: String host="localhost";
036: int port=4433;
037: String keyfile="client.pem";
038: String rootfile="root.pem";
039: String randomfile="random.pem";
040: String password="password";
041: LongOpt Longopts[]=new LongOpt[13];
042: int iterate=1;
043: boolean acceptunverified=false;
044: boolean fakeseed=false;
045: boolean checkDates=false;
046: short[] cipherSuites=null;
047: int delay=0;
048: boolean negotiateTLS=true;
049:
050: SSLContext ctx=new SSLContext();
051: SSLPolicyInt policy=new SSLPolicyInt();
052:
053: if (cipherSuites!=null)
054: {
055: policy.setCipherSuites(cipherSuites);
056: }
057:
058: policy.acceptUnverifiableCertificates(true);
059: policy.negotiateTLS(negotiateTLS);
060: ctx.setPolicy(policy);
061:
062: SSLSocket s = null;
063:
064: s = new SSLSocket(ctx,sock,host,port,SSLSocket.CLIENT);
065:
066: Vector cc=s.getCertificateChain();
067: int cs=s.getCipherSuite();
068:
069: System.out.println("Cipher suite: "+SSLPolicyInt.getCipherSuiteName(cs));
070:
071: if (cc!=null)
072: {
073: System.out.println("Cert chain");
074:
075: for(int i=0;i<cc.size();i++)
076: {
077: X509Cert cert=(X509Cert)cc.elementAt(i);
078:
079: System.out.println("Issuer "+cert.getIssuerName().getNameString());
080: System.out.println("Subject "+cert.getSubjectName().getNameString());
081: System.out.println("Serial "+cert.getSerial());
082: System.out.println("Validity "+cert.getValidityNotBefore() +"-"+ cert.getValidityNotAfter());
083: }
084: }
085:
086: System.out.println("-----");
087:
088: return s;
089: }
090: */
091:
092: protected void doSocketConnect(String host, int port)
093: throws IOException {
094: int timeout_ms = 5000; // timeout in milliseconds
095:
096: m_rdpsock = new Socket();
097: m_rdpsock.connect(new InetSocketAddress(InetAddress
098: .getByName(host), port), timeout_ms);
099: }
100: }
|