+Sat Mar 29 23:13:29 EDT 2009
+jcifs-1.3.8
+
+RC4 has been implemented which eliminates the Java 1.5u7
+requirement. JCIFS 1.3 should now work with Java 1.4 (as well as 1.2
+did anyway).
+
Thu Mar 12 14:22:47 EDT 2009
-jcifs-1.3.6a
+jcifs-1.3.7
Share security with Samba 3.0 was broken. This has been fixed.
<project name="jcifs" default="usage" basedir=".">
- <property name="version" value="1.3.7"/>
- <property name="reldate" value="Mar 18, 2009"/>
+ <property name="version" value="1.3.8"/>
+ <property name="reldate" value="Mar 29, 2009"/>
<target name="usage">
<echo>
import javax.crypto.spec.SecretKeySpec;
import java.security.GeneralSecurityException;
import jcifs.util.MD4;
+import jcifs.util.RC4;
/**
* Represents an NTLMSSP Type-3 message.
RANDOM.nextBytes(masterKey);
byte[] exchangedKey = new byte[16];
+ RC4 rc4 = new RC4(ntlm2SessionKey);
+ rc4.update(masterKey, 0, 16, exchangedKey, 0);
+/* RC4 was not added to Java until 1.5u7 so let's use our own for a little while longer ...
try {
Cipher rc4 = Cipher.getInstance("RC4");
rc4.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(ntlm2SessionKey, "RC4"));
} catch (GeneralSecurityException gse) {
throw new RuntimeException("", gse);
}
+*/
setSessionKey(exchangedKey);
} else {
RANDOM.nextBytes(masterKey);
byte[] exchangedKey = new byte[16];
+ RC4 rc4 = new RC4(userSessionKey);
+ rc4.update(masterKey, 0, 16, exchangedKey, 0);
+/* RC4 was not added to Java until 1.5u7 so let's use our own for a little while longer ...
try {
Cipher rc4 = Cipher.getInstance("RC4");
rc4.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(userSessionKey, "RC4"));
} catch (GeneralSecurityException gse) {
throw new RuntimeException("", gse);
}
+*/
setSessionKey(exchangedKey);
} else {
--- /dev/null
+/* Copyright (C) 2009 "Michael B Allen" <jcifs at samba dot org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package jcifs.util;
+
+public class RC4
+{
+
+ byte[] s;
+ int i, j;
+
+ public RC4()
+ {
+ }
+ public RC4(byte[] key)
+ {
+ init(key, 0, key.length);
+ }
+
+ public void init(byte[] key, int ki, int klen)
+ {
+ s = new byte[256];
+
+ for (i = 0; i < 256; i++)
+ s[i] = (byte)i;
+
+ for (i = j = 0; i < 256; i++) {
+ j = (j + key[ki + i % klen] + s[i]) & 0xff;
+ byte t = s[i];
+ s[i] = s[j];
+ s[j] = t;
+ }
+
+ i = j = 0;
+ }
+ public void update(byte[] src, int soff, int slen, byte[] dst, int doff)
+ {
+ int slim;
+
+ slim = soff + slen;
+ while (soff < slim) {
+ i = (i + 1) & 0xff;
+ j = (j + s[i]) & 0xff;
+ byte t = s[i];
+ s[i] = s[j];
+ s[j] = t;
+ dst[doff++] = (byte)(src[soff++] ^ s[(s[i] + s[j]) & 0xff]);
+ }
+ }
+}