[freenet-cvs] r11744 - trunk/freenet/src/freenet/keys

saces at freenetproject.org saces at freenetproject.org
Sat Feb 10 17:02:38 UTC 2007


Author: saces
Date: 2007-02-10 17:02:37 +0000 (Sat, 10 Feb 2007)
New Revision: 11744

Modified:
   trunk/freenet/src/freenet/keys/ClientSSK.java
   trunk/freenet/src/freenet/keys/USK.java
Log:
fix npe on [U|S]SK keys without extra byte

Modified: trunk/freenet/src/freenet/keys/ClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSK.java	2007-02-10 16:19:12 UTC (rev 11743)
+++ trunk/freenet/src/freenet/keys/ClientSSK.java	2007-02-10 17:02:37 UTC (rev 11744)
@@ -36,6 +36,8 @@
 		this.docName = docName;
 		this.pubKey = pubKey;
 		this.pubKeyHash = pubKeyHash;
+		if(extras == null)
+			throw new MalformedURLException("No extra bytes in SSK - maybe a 0.5 key?");
 		if(extras.length < 5)
 			throw new MalformedURLException("Extra bytes too short: "+extras.length+" bytes");
 		this.cryptoAlgorithm = extras[2];

Modified: trunk/freenet/src/freenet/keys/USK.java
===================================================================
--- trunk/freenet/src/freenet/keys/USK.java	2007-02-10 16:19:12 UTC (rev 11743)
+++ trunk/freenet/src/freenet/keys/USK.java	2007-02-10 17:02:37 UTC (rev 11744)
@@ -43,6 +43,8 @@
 		this.cryptoKey = cryptoKey;
 		this.siteName = siteName;
 		this.suggestedEdition = suggestedEdition;
+		if(extra == null)
+			throw new MalformedURLException("No extra bytes in USK");
 		// Verify extra bytes, get cryptoAlgorithm
 		ClientSSK tmp = new ClientSSK(siteName, pubKeyHash, extra, null, cryptoKey);
 		cryptoAlgorithm = tmp.cryptoAlgorithm;




More information about the cvs mailing list