Author: toad
Date: 2007-10-20 01:29:27 +0000 (Sat, 20 Oct 2007)
New Revision: 15449
Modified:
trunk/freenet/src/freenet/crypt/DSAGroup.java
trunk/freenet/src/freenet/node/NodeCrypto.java
Log:
Better error
Modified: trunk/freenet/src/freenet/crypt/DSAGroup.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAGroup.java 2007-10-17 22:14:29 UTC
(rev 15448)
+++ trunk/freenet/src/freenet/crypt/DSAGroup.java 2007-10-20 01:29:27 UTC
(rev 15449)
@@ -11,6 +11,7 @@
import java.util.Vector;
import net.i2p.util.NativeBigInteger;
+import freenet.node.FSParseException;
import freenet.support.Base64;
import freenet.support.HexUtil;
import freenet.support.IllegalBase64Exception;
@@ -213,11 +214,11 @@
return fs;
}
- public static DSAGroup create(SimpleFieldSet fs) throws
IllegalBase64Exception {
+ public static DSAGroup create(SimpleFieldSet fs) throws
IllegalBase64Exception, FSParseException {
String myP = fs.get("p");
String myQ = fs.get("q");
String myG = fs.get("g");
- if(myP == null || myQ == null || myG == null) throw new
IllegalArgumentException("The given SFS doesn't contain required fields!");
+ if(myP == null || myQ == null || myG == null) throw new
FSParseException("The given SFS doesn't contain required fields!");
BigInteger p = new NativeBigInteger(1, Base64.decode(myP));
BigInteger q = new NativeBigInteger(1, Base64.decode(myQ));
BigInteger g = new NativeBigInteger(1, Base64.decode(myG));
Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java 2007-10-17 22:14:29 UTC
(rev 15448)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java 2007-10-20 01:29:27 UTC
(rev 15449)
@@ -176,6 +176,11 @@
this.cryptoGroup = Global.DSAgroupBigA;
this.privKey = new DSAPrivateKey(cryptoGroup, random);
this.pubKey = new DSAPublicKey(cryptoGroup, privKey);
+ } catch (FSParseException e) {
+ if(logMINOR) Logger.minor(this, "Caught "+e, e);
+ this.cryptoGroup = Global.DSAgroupBigA;
+ this.privKey = new DSAPrivateKey(cryptoGroup, random);
+ this.pubKey = new DSAPublicKey(cryptoGroup, privKey);
}
InsertableClientSSK ark = null;