/* * Returned value: * 1 handshake succeeded (at least, a ServerHello was obtained) * 0 failure * -1 failure with read timeout (the server does not talk * SSL 3.x at all, so we can stop right away) */ bool TryConnect() { int num = tb.ComputeMaxCipherSuites(maxRecordLen); if (num < 1) { num = 1; } if (verbose) { Console.WriteLine("[trying version={0}, extensions={1}," + " maxLen={2} ({3} suites per hello)]", M.VersionString(tb.MaxVersion), withExts, maxRecordLen, num); } for (int i = 0; i < csl.Count; i += num) { int k = Math.Min(num, csl.Count - i); int[] cs = new int[k]; for (int j = 0; j < k; j++) { cs[j] = csl[i + j]; } tb.CipherSuites = cs; if (DoConnect() != null) { if (verbose) { Console.WriteLine(); Console.WriteLine("[hello received]"); } return(true); } if (gotReadTimeout) { /* * If we get a read timeout, then this means * that the server is not talking SSL 3.x at * all; we can thus stop right here. */ return(false); } } return(false); }
bool TryConnect() { int num = tb.ComputeMaxCipherSuites(maxRecordLen); if (num < 1) { num = 1; } if (verbose) { Console.WriteLine("[trying version={0}, extensions={1}," + " maxLen={2} ({3} suites per hello)]", M.VersionString(tb.MaxVersion), withExts, maxRecordLen, num); } for (int i = 0; i < csl.Count; i += num) { int k = Math.Min(num, csl.Count - i); int[] cs = new int[k]; for (int j = 0; j < k; j++) { cs[j] = csl[i + j]; } tb.CipherSuites = cs; if (DoConnect() != null) { if (verbose) { Console.WriteLine(); Console.WriteLine("[hello received]"); } return(true); } } return(false); }