Author: nextgens
Date: 2007-09-28 21:20:50 +0000 (Fri, 28 Sep 2007)
New Revision: 15370
Modified:
branches/freenet-jfk/src/freenet/crypt/DiffieHellmanLightContext.java
branches/freenet-jfk/src/freenet/node/FNPPacketMangler.java
Log:
Doh. Thanks to toad for spotting the bug :))
Modified: branches/freenet-jfk/src/freenet/crypt/DiffieHellmanLightContext.java
===================================================================
--- branches/freenet-jfk/src/freenet/crypt/DiffieHellmanLightContext.java
2007-09-28 21:08:09 UTC (rev 15369)
+++ branches/freenet-jfk/src/freenet/crypt/DiffieHellmanLightContext.java
2007-09-28 21:20:50 UTC (rev 15370)
@@ -42,11 +42,11 @@
/*
* Calling the following is costy; avoid
*/
- public NativeBigInteger getHMACKey(NativeBigInteger peerExponential,
DSAGroup group) {
+ public NativeBigInteger getHMACKey(NativeBigInteger peerExponential,
DHGroup group) {
BigInteger P = group.getP();
NativeBigInteger sharedSecret =
(NativeBigInteger) peerExponential.modPow(myExponent,
P);
-
+
if(logMINOR) {
Logger.minor(this, "P: "+HexUtil.biToHex(P));
Logger.minor(this, "My exponent:
"+myExponent.toHexString());
Modified: branches/freenet-jfk/src/freenet/node/FNPPacketMangler.java
===================================================================
--- branches/freenet-jfk/src/freenet/node/FNPPacketMangler.java 2007-09-28
21:08:09 UTC (rev 15369)
+++ branches/freenet-jfk/src/freenet/node/FNPPacketMangler.java 2007-09-28
21:20:50 UTC (rev 15370)
@@ -741,7 +741,7 @@
inputOffset += HASH_LENGTH;
DiffieHellmanLightContext dhContext =
getLightDiffieHellmanContext(pn);
- BigInteger computedExponential =
dhContext.getHMACKey(_hisExponential, Global.DSAgroupBigA);
+ BigInteger computedExponential =
dhContext.getHMACKey(_hisExponential, Global.DHgroupA);
if(logMINOR) Logger.minor(this, "We have computed the following
exponential : " + HexUtil.biToHex(computedExponential));
byte[] Ke = computeJFKSharedKey(computedExponential,
nonceInitiator, nonceResponder, "1");
if(logMINOR) Logger.minor(this, "We are using Ke=" +
HexUtil.bytesToHex(Ke));
@@ -866,7 +866,7 @@
byte[] r =
localSignature.getRBytes(Node.SIGNATURE_PARAMETER_LENGTH);
byte[] s =
localSignature.getSBytes(Node.SIGNATURE_PARAMETER_LENGTH);
- BigInteger computedExponential =
dhContext.getHMACKey(_hisExponential, Global.DSAgroupBigA);
+ BigInteger computedExponential =
dhContext.getHMACKey(_hisExponential, Global.DHgroupA);
if(logMINOR) Logger.minor(this, "We have computed the following
exponential : " + HexUtil.biToHex(computedExponential));
byte[] Ke = computeJFKSharedKey(computedExponential,
nonceInitiator, nonceResponder, "1");
if(logMINOR) Logger.minor(this, "We are using Ke=" +
HexUtil.bytesToHex(Ke));
@@ -969,7 +969,7 @@
DSASignature localSignature =
signDHParams(nonceInitiator,nonceResponder,_ourExponential,_hisExponential,
crypto.myIdentity);
byte[] r =
localSignature.getRBytes(Node.SIGNATURE_PARAMETER_LENGTH);
byte[] s =
localSignature.getSBytes(Node.SIGNATURE_PARAMETER_LENGTH);
- NativeBigInteger tempKey =
dhContext.getHMACKey(_hisExponential, pn.peerCryptoGroup);
+ NativeBigInteger tempKey =
dhContext.getHMACKey(_hisExponential, Global.DHgroupA);
byte[] eKey = tempKey.toByteArray();
c.initialize(encryptionKey.getEncKey(eKey,nonceInitiator,nonceResponder));
PCFBMode pk=PCFBMode.create(c);