Author: nextgens
Date: 2006-08-09 15:07:27 +0000 (Wed, 09 Aug 2006)
New Revision: 10000

Modified:
   trunk/freenet/src/freenet/crypt/DSAGroup.java
   trunk/freenet/src/freenet/crypt/DSAPrivateKey.java
   trunk/freenet/src/freenet/crypt/DSAPublicKey.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
The missing part of latest commit

Modified: trunk/freenet/src/freenet/crypt/DSAGroup.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAGroup.java       2006-08-09 14:51:04 UTC 
(rev 9999)
+++ trunk/freenet/src/freenet/crypt/DSAGroup.java       2006-08-09 15:07:27 UTC 
(rev 10000)
@@ -336,17 +336,10 @@
                return fs;
        }

-       public static DSAGroup create(SimpleFieldSet fs, boolean base64) throws 
IllegalBase64Exception {
-               if(base64) {
-                       BigInteger p = new NativeBigInteger(1, 
Base64.decode(fs.get("p")));
-                       BigInteger q = new NativeBigInteger(1, 
Base64.decode(fs.get("q")));
-                       BigInteger g = new NativeBigInteger(1, 
Base64.decode(fs.get("g")));
-                       return new DSAGroup(p, q, g);
-               } else {
-                       BigInteger p = new NativeBigInteger(1, 
HexUtil.hexToBytes(fs.get("p")));
-                       BigInteger q = new NativeBigInteger(1, 
HexUtil.hexToBytes(fs.get("q")));
-                       BigInteger g = new NativeBigInteger(1, 
HexUtil.hexToBytes(fs.get("g")));
-                       return new DSAGroup(p, q, g);
-               }
+       public static DSAGroup create(SimpleFieldSet fs) throws 
IllegalBase64Exception {
+               BigInteger p = new NativeBigInteger(1, 
Base64.decode(fs.get("p")));
+               BigInteger q = new NativeBigInteger(1, 
Base64.decode(fs.get("q")));
+               BigInteger g = new NativeBigInteger(1, 
Base64.decode(fs.get("g")));
+               return new DSAGroup(p, q, g);
        }
 }

Modified: trunk/freenet/src/freenet/crypt/DSAPrivateKey.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAPrivateKey.java  2006-08-09 14:51:04 UTC 
(rev 9999)
+++ trunk/freenet/src/freenet/crypt/DSAPrivateKey.java  2006-08-09 15:07:27 UTC 
(rev 10000)
@@ -70,10 +70,8 @@
                return fs;
        }

-       public static DSAPrivateKey create(SimpleFieldSet fs, DSAGroup group, 
boolean base64) throws IllegalBase64Exception {
-               NativeBigInteger y = new NativeBigInteger(1, 
-                               base64 ? Base64.decode(fs.get("x")) :
-                               HexUtil.hexToBytes(fs.get("x")));
+       public static DSAPrivateKey create(SimpleFieldSet fs, DSAGroup group) 
throws IllegalBase64Exception {
+               NativeBigInteger y = new NativeBigInteger(1, 
Base64.decode(fs.get("x")));
                if(y.bitLength() > 512)
                        throw new IllegalBase64Exception("Probably a pubkey");
                return new DSAPrivateKey(y);

Modified: trunk/freenet/src/freenet/crypt/DSAPublicKey.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2006-08-09 14:51:04 UTC 
(rev 9999)
+++ trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2006-08-09 15:07:27 UTC 
(rev 10000)
@@ -193,11 +193,9 @@
                return fs;
        }

-       public static DSAPublicKey create(SimpleFieldSet set, DSAGroup group, 
boolean base64) throws IllegalBase64Exception {
+       public static DSAPublicKey create(SimpleFieldSet set, DSAGroup group) 
throws IllegalBase64Exception {
                NativeBigInteger x = 
-                       new NativeBigInteger(1,
-                                       base64 ? Base64.decode(set.get("y")) :
-                                       HexUtil.hexToBytes(set.get("y")));
+                       new NativeBigInteger(1, Base64.decode(set.get("y")));
                return new DSAPublicKey(group, x);
        }
 }

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-08-09 14:51:04 UTC (rev 
9999)
+++ trunk/freenet/src/freenet/node/Node.java    2006-08-09 15:07:27 UTC (rev 
10000)
@@ -793,9 +793,8 @@
                String identity = fs.get("identity");
                if(identity == null)
                        throw new IOException();
-               boolean base64 = Fields.stringToBool(fs.get("base64"), false);
                try {
-                       myIdentity = base64 ? Base64.decode(identity) : 
HexUtil.hexToBytes(identity);
+                       myIdentity = Base64.decode(identity);
                } catch (IllegalBase64Exception e2) {
                        throw new IOException();
                }
@@ -832,9 +831,9 @@

                // FIXME: Back compatibility; REMOVE !!
                try {
-                       this.myCryptoGroup = 
DSAGroup.create(fs.subset("dsaGroup"), base64);
-                       this.myPrivKey = 
DSAPrivateKey.create(fs.subset("dsaPrivKey"), myCryptoGroup, base64);
-                       this.myPubKey = 
DSAPublicKey.create(fs.subset("dsaPubKey"), myCryptoGroup, base64);
+                       this.myCryptoGroup = 
DSAGroup.create(fs.subset("dsaGroup"));
+                       this.myPrivKey = 
DSAPrivateKey.create(fs.subset("dsaPrivKey"), myCryptoGroup);
+                       this.myPubKey = 
DSAPublicKey.create(fs.subset("dsaPubKey"), myCryptoGroup);
                } catch (NullPointerException e) {
                        Logger.minor(this, "Caught "+e, e);
                        this.myCryptoGroup = Global.DSAgroupBigA;

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2006-08-09 14:51:04 UTC 
(rev 9999)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2006-08-09 15:07:27 UTC 
(rev 10000)
@@ -274,15 +274,11 @@
      */
     public PeerNode(SimpleFieldSet fs, Node node2, boolean fromLocal) throws 
FSParseException, PeerParseException {
         this.node = node2;
-        boolean base64 = Fields.stringToBool(fs.get("base64"), false);
         String identityString = fs.get("identity");
        if(identityString == null)
                throw new PeerParseException("No identity!");
-        try {
-               if(base64)
+        try {  
                        identity = Base64.decode(identityString);
-               else
-                       identity = HexUtil.hexToBytes(identityString);
         } catch (NumberFormatException e) {
             throw new FSParseException(e);
         } catch (IllegalBase64Exception e) {
@@ -1500,9 +1496,7 @@
         boolean changedAnything = false;
         String identityString = fs.get("identity");
         try {
-            boolean base64 = Fields.stringToBool(fs.get("base64"), false);
-            byte[] newIdentity = base64 ? Base64.decode(identityString) :
-               HexUtil.hexToBytes(identityString);
+            byte[] newIdentity = Base64.decode(identityString);
             if(!Arrays.equals(newIdentity, identity))
                 throw new FSParseException("Identity changed!!");
         } catch (NumberFormatException e) {
@@ -1740,7 +1734,6 @@
                for(int i=0;i<nominalPeer.size();i++) {
                        fs.put("physical.udp", nominalPeer.get(i).toString());
                }
-        fs.put("base64", "true");
         fs.put("identity", getIdentityString());
         fs.put("location", Double.toString(currentLocation.getValue()));
         fs.put("testnet", Boolean.toString(testnetEnabled));
@@ -2316,8 +2309,4 @@
        public synchronized boolean allowLocalAddresses() {
                return allowLocalAddresses;
        }
-       
-       private synchronized boolean neverConnected() {
-               return neverConnected;
-       }
 }


Reply via email to