Author: toad
Date: 2007-12-05 14:07:52 +0000 (Wed, 05 Dec 2007)
New Revision: 16316
Modified:
trunk/freenet/src/freenet/node/NodeCrypto.java
Log:
Correct fix for the NPE.
readCrypt/initCrypt should really be in the constructor, but that would mean
refactoring the callers...
Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java 2007-12-05 14:00:20 UTC
(rev 16315)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java 2007-12-05 14:07:52 UTC
(rev 16316)
@@ -69,7 +69,7 @@
static boolean logMINOR;
final NodeCryptoConfig config;
final NodeIPPortDetector detector;
- final BlockCipher anonSetupCipher;
+ private BlockCipher anonSetupCipher;
// Noderef related
/** An ordered version of the noderef FieldSet, without the signature */
@@ -156,9 +156,6 @@
detector = new NodeIPPortDetector(node, node.ipDetector, this);
- anonSetupCipher = new Rijndael(256,256);
- } catch (UnsupportedCipherException e) {
- throw new Error(e);
} catch (NodeInitException e) {
config.stopping(this);
throw e;
@@ -244,6 +241,13 @@
}
myARK = ark;
+ try {
+ anonSetupCipher = new Rijndael(256,256);
+ } catch (UnsupportedCipherException e) {
+ throw new Error(e);
+ }
+ anonSetupCipher.initialize(identityHash);
+
}
/**
@@ -261,6 +265,12 @@
myARK = InsertableClientSSK.createRandom(random, "ark");
myARKNumber = 0;
SHA256.returnMessageDigest(md);
+ try {
+ anonSetupCipher = new Rijndael(256,256);
+ } catch (UnsupportedCipherException e) {
+ throw new Error(e);
+ }
+ anonSetupCipher.initialize(identityHash);
}
public void start(boolean disableHangchecker) {