Update of /cvsroot/freenet/freenet/src/freenet/crypt
In directory sc8-pr-cvs1:/tmp/cvs-serv18792/src/freenet/crypt
Modified Files:
DSASignature.java
Log Message:
This has been seen happening and causes trouble later if not here.. this way at least
we will detect the root of the cause
Index: DSASignature.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/crypt/DSASignature.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- DSASignature.java 13 Jan 2002 05:24:24 -0000 1.1.1.1
+++ DSASignature.java 29 Sep 2003 05:55:24 -0000 1.2
@@ -10,8 +10,8 @@
private final BigInteger r, s;
public DSASignature(InputStream in) throws IOException {
- r=Util.readMPI(in);
- s=Util.readMPI(in);
+ r=Util.readMPI(in);
+ s=Util.readMPI(in);
}
/**
@@ -19,23 +19,23 @@
* in unsigned hex-strings, separated by a comma
*/
public DSASignature(String sig) throws NumberFormatException {
- int x=sig.indexOf(',');
- if (x <= 0)
- throw new NumberFormatException("DSA Signatures have two values");
- r = new BigInteger(sig.substring(0,x), 16);
- s = new BigInteger(sig.substring(x+1), 16);
+ int x=sig.indexOf(',');
+ if (x <= 0)
+ throw new NumberFormatException("DSA Signatures have two values");
+ r = new BigInteger(sig.substring(0,x), 16);
+ s = new BigInteger(sig.substring(x+1), 16);
}
public static DSASignature read(InputStream in) throws IOException {
- BigInteger r, s;
- r=Util.readMPI(in);
- s=Util.readMPI(in);
- return new DSASignature(r,s);
+ BigInteger r, s;
+ r=Util.readMPI(in);
+ s=Util.readMPI(in);
+ return new DSASignature(r,s);
}
public void write(OutputStream o) throws IOException {
- Util.writeMPI(r, o);
- Util.writeMPI(s, o);
+ Util.writeMPI(r, o);
+ Util.writeMPI(s, o);
}
/*
public String writeAsField() {
@@ -51,16 +51,18 @@
}
public DSASignature(BigInteger r, BigInteger s) {
- this.r=r;
- this.s=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();
}
public BigInteger getR() {
- return r;
+ return r;
}
public BigInteger getS() {
- return s;
+ return s;
}
public String toString() {
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs