X-Git-Url: http://git.megacz.com/?p=org.ibex.crypto.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnet%2Fssl%2FTest.java;h=10e065660fa7f6bf869a37ac4a95f6da13984e66;hp=aa43ccbda8ddc98b5811b134582e0a0feafe6935;hb=59c78980548b7753b76f416fbd91b5309fb55ba4;hpb=65d9d2a62402d01cdac26fc7bce396fe3f108be3 diff --git a/src/org/ibex/net/ssl/Test.java b/src/org/ibex/net/ssl/Test.java index aa43ccb..10e0656 100644 --- a/src/org/ibex/net/ssl/Test.java +++ b/src/org/ibex/net/ssl/Test.java @@ -6,6 +6,7 @@ import java.io.*; public class Test { public static void main(String[] args) throws Exception { SSL.debugOn = true; + if(args.length == 1 && args[0].equals("check")) System.exit(check()); if(args.length < 2) { System.err.println("Usage: SSL host port"); } String host = args[0]; int port = Integer.parseInt(args[1]); @@ -21,12 +22,46 @@ public class Test { cat(ssl.getInputStream()); ssl.close(); } - private static void cat(InputStream is) throws IOException { + private static void cat(InputStream is) throws IOException { cat(is,100,null); } + private static void cat(InputStream is, int count, String check) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; - int count = 100; try { - while((line = br.readLine()) != null && --count >= 0) System.out.println(line); + while((line = br.readLine()) != null && --count >= 0) { + if(check != null) { + if(!line.startsWith(check)) throw new Error("\"" + check + "\" check failed"); + check = null; + } + System.out.println(line); + } } catch(SSL.PrematureCloseExn e) { /* ignore */ } } + public static int check() throws Exception { + byte[] ciphers = new byte[] { + SSL.TLS_RSA_WITH_AES_256_CBC_SHA,SSL.TLS_RSA_WITH_AES_128_CBC_SHA, + SSL.SSL_RSA_WITH_RC4_128_SHA,SSL.SSL_RSA_WITH_RC4_128_MD5 + }; + String[] hosts = new String[] { + "ssl.brianweb.net", "www.zaks.com", "www.paypal.com", "www99.americanexpress.com", "www.cnbank.com", "gmail.google.com" + }; + int[] blacklisted = new int[] { 0,3,2,3,3,0 }; + for(int i=0;i