Skip to content

Commit f0d3432

Browse files
author
dbird
committed
1 parent 9cc0f07 commit f0d3432

File tree

9 files changed

+152
-35
lines changed

9 files changed

+152
-35
lines changed

client/pom.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,38 @@
8383
</executions>
8484
</plugin>
8585
</plugins>
86-
</build>
86+
87+
<pluginManagement>
88+
<plugins>
89+
<!-- Ignore/Execute plugin execution -->
90+
<plugin>
91+
<groupId>org.eclipse.m2e</groupId>
92+
<artifactId>lifecycle-mapping</artifactId>
93+
<version>1.0.0</version>
94+
<configuration>
95+
<lifecycleMappingMetadata>
96+
<pluginExecutions>
97+
<!-- copy-dependency plugin -->
98+
<pluginExecution>
99+
<pluginExecutionFilter>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-dependency-plugin</artifactId>
102+
<versionRange>[1.0.0,)</versionRange>
103+
<goals>
104+
<goal>copy-dependencies</goal>
105+
</goals>
106+
</pluginExecutionFilter>
107+
<action>
108+
<ignore />
109+
</action>
110+
</pluginExecution>
111+
</pluginExecutions>
112+
</lifecycleMappingMetadata>
113+
</configuration>
114+
</plugin>
115+
</plugins>
116+
</pluginManagement>
117+
118+
</build>
87119

88120
</project>

core/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@
7272
</exclusions>
7373
</dependency>
7474

75+
<!--
7576
<dependency>
7677
<groupId>org.gnu</groupId>
7778
<artifactId>gnu-crypto</artifactId>
7879
<version>2.0.1</version>
7980
</dependency>
81+
-->
8082

8183
</dependencies>
8284

core/src/main/java/net/jradius/util/RadiusUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public static byte[] decodePapPassword(byte[] encryptedPass, byte[] authenticato
163163
}
164164
}
165165

166-
for (int i = 0; i < 16; i++)
166+
for (int i = 0; i < 16 && (i + n) < pwlen; i++)
167167
{
168168
out.write(encryptedPass[i + n] ^ hash[i]);
169169
}

dictionary-min/pom.xml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,37 @@
5757
</executions>
5858
</plugin>
5959
</plugins>
60-
</build>
60+
61+
<pluginManagement>
62+
<plugins>
63+
<!-- Ignore/Execute plugin execution -->
64+
<plugin>
65+
<groupId>org.eclipse.m2e</groupId>
66+
<artifactId>lifecycle-mapping</artifactId>
67+
<version>1.0.0</version>
68+
<configuration>
69+
<lifecycleMappingMetadata>
70+
<pluginExecutions>
71+
<!-- copy-dependency plugin -->
72+
<pluginExecution>
73+
<pluginExecutionFilter>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-antrun-plugin</artifactId>
76+
<versionRange>[1.0.0,)</versionRange>
77+
<goals>
78+
<goal>run</goal>
79+
</goals>
80+
</pluginExecutionFilter>
81+
<action>
82+
<ignore />
83+
</action>
84+
</pluginExecution>
85+
</pluginExecutions>
86+
</lifecycleMappingMetadata>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</pluginManagement>
91+
</build>
6192

6293
</project>

dictionary/pom.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,38 @@
5757
</executions>
5858
</plugin>
5959
</plugins>
60-
</build>
60+
61+
<pluginManagement>
62+
<plugins>
63+
<!-- Ignore/Execute plugin execution -->
64+
<plugin>
65+
<groupId>org.eclipse.m2e</groupId>
66+
<artifactId>lifecycle-mapping</artifactId>
67+
<version>1.0.0</version>
68+
<configuration>
69+
<lifecycleMappingMetadata>
70+
<pluginExecutions>
71+
<!-- copy-dependency plugin -->
72+
<pluginExecution>
73+
<pluginExecutionFilter>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-antrun-plugin</artifactId>
76+
<versionRange>[1.0.0,)</versionRange>
77+
<goals>
78+
<goal>run</goal>
79+
</goals>
80+
</pluginExecutionFilter>
81+
<action>
82+
<ignore />
83+
</action>
84+
</pluginExecution>
85+
</pluginExecutions>
86+
</lifecycleMappingMetadata>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</pluginManagement>
91+
92+
</build>
6193

6294
</project>

extended/src/main/java/net/jradius/client/auth/EAPTLSAuthenticator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,10 @@ protected byte[] tlsResponse(byte flags, byte[] data)
461461
else
462462
{
463463
length -= 1;
464-
response[1] = (byte) (length >> 24 & 0xFF);
465-
response[2] = (byte) (length >> 16 & 0xFF);
466-
response[3] = (byte) (length >> 8 & 0xFF);
467-
response[4] = (byte) (length & 0xFF);
464+
response[1] = (byte) (eapFragmentedReply.length >> 24 & 0xFF);
465+
response[2] = (byte) (eapFragmentedReply.length >> 16 & 0xFF);
466+
response[3] = (byte) (eapFragmentedReply.length >> 8 & 0xFF);
467+
response[4] = (byte) (eapFragmentedReply.length & 0xFF);
468468
System.arraycopy(data, 0, response, 5, data.length);
469469
}
470470
}

extended/src/main/java/net/jradius/util/KeyStoreUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ public class KeyStoreUtil
4343
{
4444
public static void loadBC()
4545
{
46-
if (java.security.Security.getProvider("BC") == null)
47-
java.security.Security.addProvider(new BouncyCastleProvider());
46+
try {
47+
if (java.security.Security.getProvider("BC") == null)
48+
java.security.Security.addProvider(new BouncyCastleProvider());
49+
} catch (Throwable e) { }
4850
}
4951

5052
public static KeyManager[] loadKeyManager(String type, InputStream in, String password) throws Exception

extended/src/main/java/net/jradius/webservice/SSOProxyService.java

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020

2121
package net.jradius.webservice;
2222

23-
import gnu.crypto.cipher.CipherFactory;
24-
import gnu.crypto.cipher.IBlockCipher;
25-
import gnu.crypto.util.Base64;
26-
2723
import java.net.URLDecoder;
2824
import java.security.InvalidKeyException;
2925
import java.util.HashMap;
3026
import java.util.Map;
3127

28+
import javax.crypto.Cipher;
29+
import javax.crypto.spec.SecretKeySpec;
30+
3231
import net.jradius.handler.EventHandlerBase;
3332
import net.jradius.log.RadiusLog;
3433
import net.jradius.server.JRadiusEvent;
3534
import net.jradius.session.JRadiusSession;
3635
import net.jradius.session.JRadiusSessionManager;
36+
import net.jradius.util.Base64;
3737

3838

3939
public class SSOProxyService extends EventHandlerBase
@@ -64,29 +64,15 @@ public boolean handle(JRadiusEvent event) throws Exception
6464

6565
if (!"sso".equals(command)) throw new WebServiceException("invalid command");
6666
if (payload == null) throw new WebServiceException("invalid security");
67+
68+
byte[] KeyData = cipherKey.getBytes();
69+
SecretKeySpec KS = new SecretKeySpec(KeyData, cipherType);
70+
Cipher cipher = Cipher.getInstance(cipherType);
71+
cipher.init(Cipher.DECRYPT_MODE, KS);
6772

68-
IBlockCipher cipher = CipherFactory.getInstance(cipherType);
69-
Map attributes = new HashMap();
70-
attributes.put(IBlockCipher.KEY_MATERIAL, cipherKey.getBytes());
71-
72-
try
73-
{
74-
cipher.init(attributes);
75-
}
76-
catch(InvalidKeyException e)
77-
{
78-
RadiusLog.warn(e.getMessage(), e);
79-
}
80-
81-
int bs = cipher.currentBlockSize();
8273
byte[] data = Base64.decode(payload);
83-
byte[] plaintext = new byte[(data.length / bs + 1) * bs];
74+
byte[] plaintext = cipher.doFinal(data);
8475

85-
for (int i = 0; i + bs < data.length; i += bs)
86-
{
87-
cipher.decryptBlock(data, i, plaintext, i);
88-
}
89-
9076
String scommand = URLDecoder.decode(new String(plaintext).trim(), "US-ASCII");
9177
RadiusLog.debug("Secure command: " + scommand);
9278
String session = scommand.substring("session=".length());

server/pom.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,38 @@
9595
</executions>
9696
</plugin>
9797
</plugins>
98-
</build>
98+
99+
<pluginManagement>
100+
<plugins>
101+
<!-- Ignore/Execute plugin execution -->
102+
<plugin>
103+
<groupId>org.eclipse.m2e</groupId>
104+
<artifactId>lifecycle-mapping</artifactId>
105+
<version>1.0.0</version>
106+
<configuration>
107+
<lifecycleMappingMetadata>
108+
<pluginExecutions>
109+
<!-- copy-dependency plugin -->
110+
<pluginExecution>
111+
<pluginExecutionFilter>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-dependency-plugin</artifactId>
114+
<versionRange>[1.0.0,)</versionRange>
115+
<goals>
116+
<goal>copy-dependencies</goal>
117+
</goals>
118+
</pluginExecutionFilter>
119+
<action>
120+
<ignore />
121+
</action>
122+
</pluginExecution>
123+
</pluginExecutions>
124+
</lifecycleMappingMetadata>
125+
</configuration>
126+
</plugin>
127+
</plugins>
128+
</pluginManagement>
129+
130+
</build>
99131

100132
</project>

0 commit comments

Comments
 (0)