Author: toad
Date: 2007-06-13 01:10:30 +0000 (Wed, 13 Jun 2007)
New Revision: 13552

Modified:
   trunk/freenet/src/freenet/keys/ClientSSKBlock.java
   trunk/freenet/src/freenet/keys/Key.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
   trunk/freenet/src/freenet/node/Version.java
Log:
Pick up the key from the block if it's not on the clientkey.

Modified: trunk/freenet/src/freenet/keys/ClientSSKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSKBlock.java  2007-06-13 00:07:38 UTC 
(rev 13551)
+++ trunk/freenet/src/freenet/keys/ClientSSKBlock.java  2007-06-13 01:10:30 UTC 
(rev 13552)
@@ -34,8 +34,12 @@
                this.key = key;
        }

-       public ClientSSKBlock(SSKBlock block, ClientSSK key) throws 
SSKVerifyException {
-               this(block.data, block.headers, key, false);
+       public static ClientSSKBlock construct(SSKBlock block, ClientSSK key) 
throws SSKVerifyException {
+               // Constructor expects clientkey to have the pubkey.
+               // In the case of binary blobs, the block may have it instead.
+               if(key.getPubKey() == null && block.getPubKey() != null)
+                       key.setPublicKey(block.getPubKey());
+               return new ClientSSKBlock(block.data, block.headers, key, 
false);
        }

        /**

Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java     2007-06-13 00:07:38 UTC (rev 
13551)
+++ trunk/freenet/src/freenet/keys/Key.java     2007-06-13 01:10:30 UTC (rev 
13552)
@@ -252,7 +252,7 @@

        public static ClientKeyBlock createKeyBlock(ClientKey key, KeyBlock 
block) throws KeyVerifyException {
                if(key instanceof ClientSSK)
-                       return new ClientSSKBlock((SSKBlock)block, 
(ClientSSK)key);
+                       return ClientSSKBlock.construct((SSKBlock)block, 
(ClientSSK)key);
                else //if(key instanceof ClientCHK
                        return new ClientCHKBlock((CHKBlock)block, 
(ClientCHK)key);
        }

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2007-06-13 00:07:38 UTC 
(rev 13551)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2007-06-13 01:10:30 UTC 
(rev 13552)
@@ -590,7 +590,7 @@
                                SSKBlock block = (SSKBlock)o;
                                key.setPublicKey(block.getPubKey());
                                node.unlockUID(uid, true, false);
-                               return new ClientSSKBlock(block, key);
+                               return ClientSSKBlock.construct(block, key);
                        } catch (SSKVerifyException e) {
                                Logger.error(this, "Does not verify: "+e, e);
                                throw new 
LowLevelGetException(LowLevelGetException.DECODE_FAILED);
@@ -650,7 +650,7 @@
                                try {
                                        SSKBlock block = rs.getSSKBlock();
                                        key.setPublicKey(block.getPubKey());
-                                       return new ClientSSKBlock(block, key);
+                                       return ClientSSKBlock.construct(block, 
key);
                                } catch (SSKVerifyException e) {
                                        Logger.error(this, "Does not verify: 
"+e, e);
                                        throw new 
LowLevelGetException(LowLevelGetException.DECODE_FAILED);

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2007-06-13 00:07:38 UTC (rev 
13551)
+++ trunk/freenet/src/freenet/node/Version.java 2007-06-13 01:10:30 UTC (rev 
13552)
@@ -24,7 +24,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 1036;
+       private static final int buildNumber = 1035;

        /** Oldest build of Fred we will talk to */
        private static final int oldLastGoodBuild = 1029;


Reply via email to