[freenet-cvs] r17319 - trunk/freenet/src/freenet/crypt

nextgens at freenetproject.org nextgens at freenetproject.org
Sun Jan 27 13:49:37 UTC 2008


Author: nextgens
Date: 2008-01-27 13:49:37 +0000 (Sun, 27 Jan 2008)
New Revision: 17319

Modified:
   trunk/freenet/src/freenet/crypt/DSASignature.java
Log:
DSASignature enforce the sign check on *all* constructors

Modified: trunk/freenet/src/freenet/crypt/DSASignature.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSASignature.java	2008-01-27 13:40:56 UTC (rev 17318)
+++ trunk/freenet/src/freenet/crypt/DSASignature.java	2008-01-27 13:49:37 UTC (rev 17319)
@@ -21,6 +21,7 @@
     public DSASignature(InputStream in) throws IOException {
 		r=Util.readMPI(in);
 		s=Util.readMPI(in);
+		if(r.signum() != 1 || s.signum() != 1) throw new IOException("Both R and S should be positive!");
     }
 
     /**
@@ -51,8 +52,6 @@
     public DSASignature(BigInteger r, BigInteger s) {
 		this.r=r;
 		this.s=s;
-		if((r == null) || (s == null)) //Do not allow this sice we wont do any sanity checking beyond this place
-			throw new NullPointerException();
 		if(r.signum() != 1 || s.signum() != 1) throw new IllegalArgumentException();
     }
 




More information about the cvs mailing list