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

toad at freenetproject.org toad at freenetproject.org
Thu Mar 8 14:33:11 UTC 2007


Author: toad
Date: 2007-03-08 14:33:11 +0000 (Thu, 08 Mar 2007)
New Revision: 12032

Modified:
   trunk/freenet/src/freenet/keys/ClientSSK.java
Log:
More info on failure, check before assigning

Modified: trunk/freenet/src/freenet/keys/ClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSK.java	2007-03-08 12:55:27 UTC (rev 12031)
+++ trunk/freenet/src/freenet/keys/ClientSSK.java	2007-03-08 14:33:11 UTC (rev 12032)
@@ -12,6 +12,7 @@
 import freenet.crypt.SHA256;
 import freenet.crypt.UnsupportedCipherException;
 import freenet.crypt.ciphers.Rijndael;
+import freenet.support.HexUtil;
 import freenet.support.Logger;
 
 public class ClientSSK extends ClientKey {
@@ -85,9 +86,9 @@
 	public void setPublicKey(DSAPublicKey pubKey) {
 		if((this.pubKey != null) && (this.pubKey != pubKey) && !this.pubKey.equals(pubKey))
 			throw new IllegalArgumentException("Cannot reassign: was "+this.pubKey+" now "+pubKey);
+		if(!Arrays.equals(pubKey.asBytesHash(), pubKeyHash))
+			throw new IllegalArgumentException("New pubKey hash does not match pubKeyHash: "+HexUtil.bytesToHex(pubKey.asBytesHash())+" != "+HexUtil.bytesToHex(pubKeyHash)+" for "+pubKey);
 		this.pubKey = pubKey;
-		if(!Arrays.equals(pubKey.asBytesHash(), pubKeyHash))
-			throw new IllegalArgumentException();
 	}
 	
 	public FreenetURI getURI() {




More information about the cvs mailing list