From 4f1aad4e9c5d755d602cbfcf95ff01eb75ffc5dd Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 06:48:56 +0000 Subject: [PATCH] 2002/07/15 23:18:07 darcs-hash:20040130064856-2ba56-3cdaab780306bc3f37fed70f79b83b4bf3f79891.gz --- CHANGES | 2 + src/org/xwt/TinySSL.java | 219 +++++++++++++++++++++++++--------------------- 2 files changed, 120 insertions(+), 101 deletions(-) diff --git a/CHANGES b/CHANGES index 3dcf24f..c4952cd 100644 --- a/CHANGES +++ b/CHANGES @@ -261,3 +261,5 @@ 15-Jul megacz SpecialBoxProperty.java: redirect property, color/textcolor error message tweak. + +15-Jul megacz TinySSL.java: speed improvement on certificate checks \ No newline at end of file diff --git a/src/org/xwt/TinySSL.java b/src/org/xwt/TinySSL.java index 44b998c..d036d33 100644 --- a/src/org/xwt/TinySSL.java +++ b/src/org/xwt/TinySSL.java @@ -112,6 +112,7 @@ public class TinySSL extends Socket { public static class SSLException extends IOException { public SSLException(String s) { super(s); } } static SubjectPublicKeyInfo[] trusted_CA_public_keys; + static String[] trusted_CA_public_key_identifiers; public static byte[] pad1 = new byte[48]; public static byte[] pad2 = new byte[48]; public static byte[] pad1_sha = new byte[40]; @@ -386,7 +387,7 @@ public class TinySSL extends Socket { Log.log(this, "server cert (name, validity dates) checks out okay"); } else if (!isSignedBy(last_cert, this_cert.getSubjectPublicKeyInfo())) - throw new SSLException("certificate chain discontinuity"); + throw new SSLException("the server sent a broken chain of certificates"); last_cert = this_cert; i += certlen + 3; @@ -395,13 +396,27 @@ public class TinySSL extends Socket { if (Log.on) Log.log(this, " Certificate (" + numcerts + " certificates)"); boolean good = false; + + // pass 1 -- only check CA's whose subject is a partial match + String subject = this_cert.getSubject().toString(); for(int i=0; i