Author: toad
Date: 2007-04-26 21:12:28 +0000 (Thu, 26 Apr 2007)
New Revision: 13001

Modified:
   trunk/freenet/src/freenet/crypt/DSAPublicKey.java
Log:
More DSA checks

Modified: trunk/freenet/src/freenet/crypt/DSAPublicKey.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-04-26 20:40:07 UTC 
(rev 13000)
+++ trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-04-26 21:12:28 UTC 
(rev 13001)
@@ -27,6 +27,8 @@
        if(y.signum() != 1) throw new IllegalArgumentException();
                this.y=y;
                this.group=g;
+               if(y.compareTo(g.getP()) > 0)
+                       throw new IllegalArgumentException("y must be < p but 
y="+y+" p="+g.getP());
                if(g == null) throw new NullPointerException();
     }

@@ -48,7 +50,8 @@
     public DSAPublicKey(InputStream is) throws IOException, 
CryptFormatException {
                group=(DSAGroup) DSAGroup.read(is);
                y=Util.readMPI(is);
-               // FIXME should check y < group.something?
+               if(y.compareTo(group.getP()) > 0)
+                       throw new IllegalArgumentException("y must be < p but 
y="+y+" p="+group.getP());
     }

     public static DSAPublicKey create(byte[] pubkeyAsBytes) throws 
CryptFormatException {


Reply via email to