Author: toad
Date: 2007-03-08 00:05:23 +0000 (Thu, 08 Mar 2007)
New Revision: 12023

Modified:
   trunk/freenet/src/freenet/crypt/DSAGroup.java
   trunk/freenet/src/freenet/crypt/DSAPublicKey.java
Log:
Don't break the whole startup if we read an invalid public key.

Modified: trunk/freenet/src/freenet/crypt/DSAGroup.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAGroup.java       2007-03-08 00:00:43 UTC 
(rev 12022)
+++ trunk/freenet/src/freenet/crypt/DSAGroup.java       2007-03-08 00:05:23 UTC 
(rev 12023)
@@ -81,7 +81,11 @@
         p = Util.readMPI(i);
         q = Util.readMPI(i);
         g = Util.readMPI(i);
-        return new DSAGroup(p, q, g);
+        try {
+               return new DSAGroup(p, q, g);
+        } catch (IllegalArgumentException e) {
+               throw new IOException("Invalid group");
+        }
     }

     public void writeForWire(OutputStream out) throws IOException {

Modified: trunk/freenet/src/freenet/crypt/DSAPublicKey.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-03-08 00:00:43 UTC 
(rev 12022)
+++ trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-03-08 00:05:23 UTC 
(rev 12023)
@@ -48,6 +48,7 @@
     public DSAPublicKey(InputStream is) throws IOException {
                group=(DSAGroup) DSAGroup.read(is);
                y=Util.readMPI(is);
+               // FIXME should check y < group.something?
     }

     public DSAPublicKey(byte[] pubkeyAsBytes) throws IOException {


Reply via email to