Author: toad
Date: 2007-02-13 23:38:00 +0000 (Tue, 13 Feb 2007)
New Revision: 11776

Modified:
   trunk/freenet/src/freenet/keys/USK.java
Log:
More checks on creating a USK

Modified: trunk/freenet/src/freenet/keys/USK.java
===================================================================
--- trunk/freenet/src/freenet/keys/USK.java     2007-02-13 23:32:55 UTC (rev 
11775)
+++ trunk/freenet/src/freenet/keys/USK.java     2007-02-13 23:38:00 UTC (rev 
11776)
@@ -44,8 +44,12 @@
                this.siteName = siteName;
                this.suggestedEdition = suggestedEdition;
                if(extra == null)
-                       throw new MalformedURLException("No extra bytes in 
USK");
-               // Verify extra bytes, get cryptoAlgorithm
+                       throw new MalformedURLException("No extra bytes (third 
bit) in USK");
+               if(pubKeyHash == null)
+                       throw new MalformedURLException("No pubkey hash (first 
bit) in USK");
+               if(cryptoKey == null)
+                       throw new MalformedURLException("No crypto key (second 
bit) in USK");
+               // Verify extra bytes, get cryptoAlgorithm - FIXME this should 
be a static method or something?
                ClientSSK tmp = new ClientSSK(siteName, pubKeyHash, extra, 
null, cryptoKey);
                cryptoAlgorithm = tmp.cryptoAlgorithm;
                if(pubKeyHash.length != NodeSSK.PUBKEY_HASH_SIZE)


Reply via email to