Skip to content

Commit 6286cfa

Browse files
authored
Merge pull request #676 from RUB-NDS/java-11-compatibility
update deps and plugins; java 11 compatibility
2 parents 0ca4581 + 5780499 commit 6286cfa

File tree

23 files changed

+255
-161
lines changed

23 files changed

+255
-161
lines changed

.travis.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,44 @@
11
language: java
22

3-
sudo: false
3+
os: linux
4+
dist: bionic
5+
script: mvn clean test
46

5-
script: mvn clean package -Dmaven.javadoc.skip=true
7+
stages:
8+
- name: test
9+
- name: package
10+
if: branch = master
611

7-
jdk:
8-
- oraclejdk8
9-
- openjdk8
12+
jobs:
13+
include:
14+
- stage: test
15+
name: "Test against OracleJDK 8 @ Ubuntu Trusty (14.04)"
16+
jdk: oraclejdk8
17+
dist: trusty
1018

11-
branches:
12-
only:
13-
- master
19+
- stage: test
20+
name: "Test against OracleJDK 11 @ Ubuntu Bionic (18.04)"
21+
jdk: oraclejdk11
22+
dist: bionic
23+
24+
- stage: test
25+
name: "Test against OpenJDK 8 @ Ubuntu Bionic (18.04)"
26+
jdk: openjdk8
27+
dist: bionic
28+
29+
- stage: test
30+
name: "Test against OpenJDK 11 @ Ubuntu Bionic (18.04)"
31+
jdk: openjdk11
32+
dist: bionic
33+
34+
- stage: package
35+
name: "Packaging JARs"
36+
jdk: openjdk11
37+
script: mvn clean package -Dmaven.javadoc.skip=true
1438

1539
notifications:
1640
email:
41+
if: branch = master
1742
recipients:
18-
- juraj.somorovsky@hackmanit.de
43+
- juraj.somorovsky@hackmanit.de
44+

Attacks/nb-configuration.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@
2222
<de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>true</de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>
2323
<de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>false</de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>
2424
<de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>true</de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>
25-
<netbeans.hint.jdkPlatform>JDK_1.7</netbeans.hint.jdkPlatform>
2625
</properties>
2726
</project-shared-configuration>

Attacks/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
</dependency>
1717
</dependencies>
1818
<build>
19-
<finalName>Attacks</finalName>
19+
<finalName>Attacks</finalName>
2020
<plugins>
2121
<plugin>
2222
<artifactId>maven-clean-plugin</artifactId>
23-
<version>3.0.0</version>
23+
<version>3.1.0</version>
2424
<configuration>
2525
<filesets>
2626
<fileset>
@@ -44,7 +44,7 @@
4444
<!-- Build an executable JAR -->
4545
<groupId>org.apache.maven.plugins</groupId>
4646
<artifactId>maven-jar-plugin</artifactId>
47-
<version>2.6</version>
47+
<version>3.2.0</version>
4848
<configuration>
4949
<archive>
5050
<manifest>
@@ -62,8 +62,8 @@
6262
</plugins>
6363
</build>
6464
<properties>
65-
<maven.compiler.source>1.7</maven.compiler.source>
66-
<maven.compiler.target>1.7</maven.compiler.target>
65+
<maven.compiler.source>1.8</maven.compiler.source>
66+
<maven.compiler.target>1.8</maven.compiler.target>
6767
<main.basedir>${project.parent.basedir}</main.basedir>
6868
</properties>
6969
</project>

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/Main.java

Lines changed: 67 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
package de.rub.nds.tlsattacker.attacks;
1111

1212
import com.beust.jcommander.JCommander;
13+
import com.beust.jcommander.JCommander.Builder;
14+
import com.beust.jcommander.ParameterException;
1315
import de.rub.nds.tlsattacker.attacks.config.*;
1416
import de.rub.nds.tlsattacker.attacks.config.delegate.GeneralAttackDelegate;
1517
import de.rub.nds.tlsattacker.attacks.impl.*;
@@ -35,53 +37,81 @@ public class Main {
3537
*/
3638
public static void main(String[] args) {
3739
GeneralDelegate generalDelegate = new GeneralAttackDelegate();
38-
JCommander jc = new JCommander(generalDelegate);
40+
Builder builder = JCommander.newBuilder().addObject(generalDelegate);
41+
3942
BleichenbacherCommandConfig bleichenbacherTest = new BleichenbacherCommandConfig(generalDelegate);
40-
jc.addCommand(BleichenbacherCommandConfig.ATTACK_COMMAND, bleichenbacherTest);
43+
builder.addCommand(BleichenbacherCommandConfig.ATTACK_COMMAND, bleichenbacherTest);
4144

4245
PskBruteForcerAttackServerCommandConfig pskBruteForcerAttackServerTest = new PskBruteForcerAttackServerCommandConfig(
4346
generalDelegate);
44-
jc.addCommand(PskBruteForcerAttackServerCommandConfig.ATTACK_COMMAND, pskBruteForcerAttackServerTest);
47+
builder.addCommand(PskBruteForcerAttackServerCommandConfig.ATTACK_COMMAND, pskBruteForcerAttackServerTest);
4548

4649
PskBruteForcerAttackClientCommandConfig pskBruteForcerAttackClientTest = new PskBruteForcerAttackClientCommandConfig(
4750
generalDelegate);
48-
jc.addCommand(PskBruteForcerAttackClientCommandConfig.ATTACK_COMMAND, pskBruteForcerAttackClientTest);
51+
builder.addCommand(PskBruteForcerAttackClientCommandConfig.ATTACK_COMMAND, pskBruteForcerAttackClientTest);
52+
4953
InvalidCurveAttackConfig ellipticTest = new InvalidCurveAttackConfig(generalDelegate);
50-
jc.addCommand(InvalidCurveAttackConfig.ATTACK_COMMAND, ellipticTest);
54+
builder.addCommand(InvalidCurveAttackConfig.ATTACK_COMMAND, ellipticTest);
55+
5156
HeartbleedCommandConfig heartbleed = new HeartbleedCommandConfig(generalDelegate);
52-
jc.addCommand(HeartbleedCommandConfig.ATTACK_COMMAND, heartbleed);
57+
builder.addCommand(HeartbleedCommandConfig.ATTACK_COMMAND, heartbleed);
5358

5459
Lucky13CommandConfig lucky13 = new Lucky13CommandConfig(generalDelegate);
55-
jc.addCommand(Lucky13CommandConfig.ATTACK_COMMAND, lucky13);
60+
builder.addCommand(Lucky13CommandConfig.ATTACK_COMMAND, lucky13);
5661

5762
PaddingOracleCommandConfig paddingOracle = new PaddingOracleCommandConfig(generalDelegate);
58-
jc.addCommand(PaddingOracleCommandConfig.ATTACK_COMMAND, paddingOracle);
63+
builder.addCommand(PaddingOracleCommandConfig.ATTACK_COMMAND, paddingOracle);
64+
5965
TLSPoodleCommandConfig tlsPoodle = new TLSPoodleCommandConfig(generalDelegate);
60-
jc.addCommand(TLSPoodleCommandConfig.ATTACK_COMMAND, tlsPoodle);
66+
builder.addCommand(TLSPoodleCommandConfig.ATTACK_COMMAND, tlsPoodle);
67+
6168
Cve20162107CommandConfig cve20162107 = new Cve20162107CommandConfig(generalDelegate);
62-
jc.addCommand(Cve20162107CommandConfig.ATTACK_COMMAND, cve20162107);
69+
builder.addCommand(Cve20162107CommandConfig.ATTACK_COMMAND, cve20162107);
70+
6371
EarlyCCSCommandConfig earlyCCS = new EarlyCCSCommandConfig(generalDelegate);
64-
jc.addCommand(EarlyCCSCommandConfig.ATTACK_COMMAND, earlyCCS);
72+
builder.addCommand(EarlyCCSCommandConfig.ATTACK_COMMAND, earlyCCS);
73+
6574
EarlyFinishedCommandConfig earlyFin = new EarlyFinishedCommandConfig(generalDelegate);
66-
jc.addCommand(EarlyFinishedCommandConfig.ATTACK_COMMAND, earlyFin);
75+
builder.addCommand(EarlyFinishedCommandConfig.ATTACK_COMMAND, earlyFin);
76+
6777
PoodleCommandConfig poodle = new PoodleCommandConfig(generalDelegate);
68-
jc.addCommand(PoodleCommandConfig.ATTACK_COMMAND, poodle);
78+
builder.addCommand(PoodleCommandConfig.ATTACK_COMMAND, poodle);
79+
6980
SimpleMitmProxyCommandConfig simpleMitmProxy = new SimpleMitmProxyCommandConfig(generalDelegate);
70-
jc.addCommand(SimpleMitmProxyCommandConfig.ATTACK_COMMAND, simpleMitmProxy);
81+
builder.addCommand(SimpleMitmProxyCommandConfig.ATTACK_COMMAND, simpleMitmProxy);
82+
7183
GeneralDrownCommandConfig generalDrownConfig = new GeneralDrownCommandConfig(generalDelegate);
72-
jc.addCommand(GeneralDrownCommandConfig.COMMAND, generalDrownConfig);
84+
builder.addCommand(GeneralDrownCommandConfig.COMMAND, generalDrownConfig);
85+
7386
SpecialDrownCommandConfig specialDrownConfig = new SpecialDrownCommandConfig(generalDelegate);
74-
jc.addCommand(SpecialDrownCommandConfig.COMMAND, specialDrownConfig);
75-
jc.parse(args);
76-
if (generalDelegate.isHelp() || jc.getParsedCommand() == null) {
77-
if (jc.getParsedCommand() == null) {
78-
jc.usage();
87+
builder.addCommand(SpecialDrownCommandConfig.COMMAND, specialDrownConfig);
88+
89+
JCommander jc = builder.build();
90+
91+
try {
92+
jc.parse(args);
93+
} catch (ParameterException ex) {
94+
String parsedCommand = ex.getJCommander().getParsedCommand();
95+
if (parsedCommand != null) {
96+
ex.getJCommander().getUsageFormatter().usage(parsedCommand);
7997
} else {
80-
jc.usage(jc.getParsedCommand());
98+
ex.usage();
8199
}
82100
return;
83101
}
102+
103+
if (jc.getParsedCommand() == null) {
104+
jc.usage();
105+
return;
106+
}
107+
108+
if (generalDelegate.isHelp()) {
109+
jc.getUsageFormatter().usage(jc.getParsedCommand());
110+
return;
111+
}
112+
84113
Attacker<? extends TLSDelegateConfig> attacker = null;
114+
85115
switch (jc.getParsedCommand()) {
86116
case BleichenbacherCommandConfig.ATTACK_COMMAND:
87117
attacker = new BleichenbacherAttacker(bleichenbacherTest, bleichenbacherTest.createConfig());
@@ -131,41 +161,28 @@ public static void main(String[] args) {
131161
attacker = new SpecialDrownAttacker(specialDrownConfig, specialDrownConfig.createConfig());
132162
break;
133163
default:
134-
throw new ConfigurationException("Command not found");
164+
break;
135165
}
166+
136167
if (attacker == null) {
137-
throw new ConfigurationException("Attacker not found");
168+
throw new ConfigurationException("Command not found");
138169
}
139-
if (isPrintHelpForCommand(jc, attacker.getConfig())) {
140-
jc.usage(jc.getParsedCommand());
141-
} else {
142170

143-
if (attacker.getConfig().isExecuteAttack()) {
144-
attacker.attack();
145-
} else {
146-
try {
147-
Boolean result = attacker.checkVulnerability();
148-
if (Objects.equals(result, Boolean.TRUE)) {
149-
CONSOLE.error("Vulnerable:" + result.toString());
150-
} else if (Objects.equals(result, Boolean.FALSE)) {
151-
CONSOLE.info("Vulnerable:" + result.toString());
152-
} else {
153-
CONSOLE.warn("Vulnerable: Uncertain");
154-
}
155-
} catch (UnsupportedOperationException E) {
156-
LOGGER.info("The selected attacker is currently not implemented");
171+
if (attacker.getConfig().isExecuteAttack()) {
172+
attacker.attack();
173+
} else {
174+
try {
175+
Boolean result = attacker.checkVulnerability();
176+
if (Objects.equals(result, Boolean.TRUE)) {
177+
CONSOLE.error("Vulnerable:" + result.toString());
178+
} else if (Objects.equals(result, Boolean.FALSE)) {
179+
CONSOLE.info("Vulnerable:" + result.toString());
180+
} else {
181+
CONSOLE.warn("Vulnerable: Uncertain");
157182
}
183+
} catch (UnsupportedOperationException E) {
184+
LOGGER.info("The selected attacker is currently not implemented");
158185
}
159186
}
160187
}
161-
162-
/**
163-
*
164-
* @param jc
165-
* @param config
166-
* @return
167-
*/
168-
public static boolean isPrintHelpForCommand(JCommander jc, TLSDelegateConfig config) {
169-
return config.getGeneralDelegate().isHelp();
170-
}
171188
}

Attacks/src/main/java/de/rub/nds/tlsattacker/attacks/cca/CcaCertificateManager.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import de.rub.nds.x509attacker.xmlsignatureengine.XmlSignatureEngine;
2727
import org.apache.logging.log4j.LogManager;
2828
import org.apache.logging.log4j.Logger;
29-
import sun.security.rsa.RSAPrivateCrtKeyImpl;
30-
import sun.security.rsa.RSAPublicKeyImpl;
3129

3230
import javax.crypto.interfaces.DHPrivateKey;
3331
import javax.crypto.interfaces.DHPublicKey;
@@ -45,6 +43,8 @@
4543
import java.security.interfaces.DSAPublicKey;
4644
import java.security.interfaces.ECPrivateKey;
4745
import java.security.interfaces.ECPublicKey;
46+
import java.security.interfaces.RSAPrivateKey;
47+
import java.security.interfaces.RSAPublicKey;
4848
import java.security.spec.ECPoint;
4949
import java.util.HashMap;
5050
import java.util.List;
@@ -211,7 +211,7 @@ private String replacePlaceholders(String xmlString, String rootCertificateKeyNa
211211
* This is a wrapper function to write a generated certificate chain to
212212
* disk. This is needed since X.509-Attacker still uses a two dimensional
213213
* byte array for encoded certificates rather than a LinkedList.
214-
*
214+
*
215215
* @param outputDirectory
216216
* @param certificates
217217
* @param ccaCertificateChain
@@ -232,7 +232,7 @@ private void saveCertificateChainToFile(String outputDirectory, List<Asn1Encodab
232232
/**
233233
* Based on the provided parameters this function adds the correct Custom
234234
* Private/Public Keys to the certificate chain.
235-
*
235+
*
236236
* @param ccaCertificateChain
237237
* @param keyName
238238
* @param pubKeyName
@@ -254,15 +254,14 @@ private boolean setLeafCertificateKeys(CcaCertificateChain ccaCertificateChain,
254254
keyBytes = keyFileManager.getKeyFileContent(keyName);
255255

256256
privateKey = readPrivateKey(new ByteArrayInputStream(keyBytes));
257-
BigInteger modulus = ((RSAPrivateCrtKeyImpl) privateKey).getModulus();
258-
BigInteger d = ((RSAPrivateCrtKeyImpl) privateKey).getPrivateExponent();
257+
BigInteger modulus = ((RSAPrivateKey) privateKey).getModulus();
258+
BigInteger d = ((RSAPrivateKey) privateKey).getPrivateExponent();
259259
customPrivateKey = new CustomRSAPrivateKey(modulus, d);
260260

261261
pubKeyBytes = keyFileManager.getKeyFileContent(pubKeyName);
262262

263263
PublicKey publicKey = PemUtil.readPublicKey(new ByteArrayInputStream(pubKeyBytes));
264-
customPublicKey = new CustomRsaPublicKey(((RSAPublicKeyImpl) publicKey).getPublicExponent(),
265-
modulus);
264+
customPublicKey = new CustomRsaPublicKey(((RSAPublicKey) publicKey).getPublicExponent(), modulus);
266265
break;
267266
case DH:
268267
keyBytes = keyFileManager.getKeyFileContent(keyName);

TLS-Client/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<artifactId>TLS-Client</artifactId>
1111
<packaging>jar</packaging>
1212
<build>
13-
<finalName>TLS-Client</finalName>
13+
<finalName>TLS-Client</finalName>
1414
<plugins>
1515
<plugin>
1616
<!-- Build an executable JAR -->
1717
<groupId>org.apache.maven.plugins</groupId>
1818
<artifactId>maven-jar-plugin</artifactId>
19-
<version>2.6</version>
19+
<version>3.2.0</version>
2020
<configuration>
2121
<archive>
2222
<manifest>
@@ -29,7 +29,7 @@
2929
</plugin>
3030
<plugin>
3131
<artifactId>maven-clean-plugin</artifactId>
32-
<version>3.0.0</version>
32+
<version>3.1.0</version>
3333
<configuration>
3434
<filesets>
3535
<fileset>
@@ -65,8 +65,8 @@
6565
</dependency>
6666
</dependencies>
6767
<properties>
68-
<maven.compiler.source>1.7</maven.compiler.source>
69-
<maven.compiler.target>1.7</maven.compiler.target>
68+
<maven.compiler.source>1.8</maven.compiler.source>
69+
<maven.compiler.target>1.8</maven.compiler.target>
7070
<main.basedir>${project.parent.basedir}</main.basedir>
7171
</properties>
7272
</project>

TLS-Core/nb-configuration.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
-->
99
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
1010
<!--
11-
Properties that influence various parts of the IDE, especially code formatting and the like.
11+
Properties that influence various parts of the IDE, especially code formatting and the like.
1212
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
1313
That way multiple projects can share the same settings (useful for formatting rules for example).
1414
Any value defined here will override the pom.xml file value but is only applicable to the current project.
@@ -22,7 +22,6 @@
2222
<de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>true</de-markiewb-netbeans-plugins-eclipse-formatter.eclipseFormatterEnabled>
2323
<de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>false</de-markiewb-netbeans-plugins-eclipse-formatter.enableFormatAsSaveAction>
2424
<de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>true</de-markiewb-netbeans-plugins-eclipse-formatter.useProjectSettings>
25-
<netbeans.hint.jdkPlatform>JDK_1.8_Oracle</netbeans.hint.jdkPlatform>
2625
<netbeans.compile.on.save>all</netbeans.compile.on.save>
2726
</properties>
2827
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">

0 commit comments

Comments
 (0)