Skip to content

Commit

Permalink
Merge pull request #42 from pilec/je-update-to-java-10
Browse files Browse the repository at this point in the history
Update client to Java 11
  • Loading branch information
todvora authored Feb 20, 2020
2 parents b0a1d4a + 258d234 commit 82e3671
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ dist: trusty
jdk:
- oraclejdk8
- openjdk8
- openjdk7
- openjdk10
- openjdk11

before_install:
- export TZ=Europe/Prague
Expand All @@ -31,7 +32,6 @@ deploy:
- target/eet-client-*.*
on:
tags: true
jdk: openjdk7

- provider: script
script: scripts/deploy-pages.sh
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ Since EET client has to deal with lots of encryption and security, up-to-date ve
Supported and tested are following versions:

- Oracle JDK 8
- OpenJDK 8
- OpenJDK 10
- OpenJDK 11

For following JDK versions please stay on 3.0.0 release:
- Oracle JDK 7
- OpenJDK 7
- OpenJDK 6
Expand Down
23 changes: 16 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.0.10</cxf.version>
<!-- <maven.compile.source>10</maven.compile.source>
<maven.compile.target>10</maven.compile.target> -->

<cxf.version>3.3.5</cxf.version>
<junit.version>4.12</junit.version>
<slf4j.version>1.7.24</slf4j.version>
<log4j.version>2.3</log4j.version>
<log4j.version>2.11.1</log4j.version>
<maven-failsafe.version>2.19.1</maven-failsafe.version>
<jacoco.version>0.7.7.201606060606</jacoco.version>
<jacoco.version>0.8.5</jacoco.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
<jaxws.version>2.3.0</jaxws.version>
</properties>

<scm>
Expand Down Expand Up @@ -102,6 +106,11 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
Expand All @@ -113,7 +122,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.8.9</version>
<version>2.21.0</version>
<scope>test</scope>
</dependency>

Expand All @@ -125,7 +134,7 @@
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.0.9</version>
<version>3.3.5</version>
<executions>
<execution>
<id>generate-sources</id>
Expand Down Expand Up @@ -172,7 +181,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.8.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand Down Expand Up @@ -361,4 +370,4 @@
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cz.tomasdvorak.eet.client.security;

import org.apache.wss4j.common.crypto.Merlin;
import org.apache.xml.security.Init;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -15,6 +16,8 @@ public MerlinWithCRLDistributionPointsExtension() {
}

private void configureSystemProperties() {
Init.init();

final boolean crlDownloadEnabled = Boolean.getBoolean("com.sun.security.enableCRLDP");
final boolean checkRevocationEnabled = Boolean.getBoolean("com.sun.net.ssl.checkRevocation");
final String value = Security.getProperty("com.sun.security.onlyCheckRevocationOfEECert");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Specialization of {@link WSS4JOutInterceptor} that uses exchange to mark
* messages that have to be validated by {@link WSS4JEetInInterceptor}
*
*
* @author Petr Kalivoda
*
*/
Expand All @@ -34,12 +34,12 @@ public void handleMessage(SoapMessage message) throws Fault {
TrzbaType request = (TrzbaType) requestObj;
TrzbaHlavickaType header = request.getHlavicka();

// validation is required if isOvereni is unspecified or false.
boolean required = header == null || !Boolean.TRUE.equals(header.isOvereni());
// validation is required if getOvereni is unspecified or false.
boolean required = header == null || !Boolean.TRUE.equals(header.getOvereni());
message.getExchange().put(WSS4JEetInInterceptor.PROP_SIGNATURE_REQUIRED, required);
}
}

}

}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package cz.tomasdvorak.eet.client.security;

import cz.tomasdvorak.eet.client.exceptions.InvalidKeystoreException;
import org.apache.wss4j.common.crypto.Merlin;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.io.InputStream;
import java.security.KeyStore;
import java.security.cert.CertificateException;
Expand All @@ -16,6 +9,14 @@
import java.util.Collection;
import java.util.regex.Pattern;

import org.apache.wss4j.common.crypto.Merlin;
import org.apache.wss4j.common.ext.WSSecurityException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import cz.tomasdvorak.eet.client.exceptions.InvalidKeystoreException;

public class MerlinWithCRLDistributionPointsExtensionTest {

private KeyStore keystore;
Expand All @@ -29,16 +30,16 @@ public void setUp() throws Exception {
keystore = getTruststore("/certificates/rca15_rsa.der", "/certificates/2qca16_rsa.der");
}


@Ignore("Disabled due to expired test certificate as well")
@Test
public void verifyTrustPlayground() throws Exception {
final Merlin crypto = new MerlinWithCRLDistributionPointsExtension();
final boolean enableRevocation = true;
final Collection<Pattern> subjectCertConstraints = new ArrayList<Pattern>();
subjectCertConstraints.add(Pattern.compile(SecureEETCommunication.SUBJECT_CERT_CONSTRAINTS));
final X509Certificate[] certsPlayground = {playgroundCertificate};
final X509Certificate[] certsPlayground = { playgroundCertificate };
crypto.setTrustStore(keystore);
crypto.verifyTrust(certsPlayground, enableRevocation, subjectCertConstraints);
crypto.verifyTrust(certsPlayground, enableRevocation, subjectCertConstraints, null);
}

@Ignore("Disabled due to expired production certificate. Help needed, please see https://github.com/todvora/eet-client/issues/35#issuecomment-340262163")
Expand All @@ -48,16 +49,14 @@ public void verifyTrustProduction() throws WSSecurityException {
final boolean enableRevocation = true;
final Collection<Pattern> subjectCertConstraints = new ArrayList<Pattern>();
subjectCertConstraints.add(Pattern.compile(SecureEETCommunication.SUBJECT_CERT_CONSTRAINTS));
final X509Certificate[] certsProduction = {productionCertificate};
final X509Certificate[] certsProduction = { productionCertificate };
crypto.setTrustStore(keystore);
crypto.verifyTrust(certsProduction, enableRevocation, subjectCertConstraints);
crypto.verifyTrust(certsProduction, enableRevocation, subjectCertConstraints, null);
}



private KeyStore getTruststore(final String... certificate) throws InvalidKeystoreException {
final InputStream[] streams = new InputStream[certificate.length];
for(int i = 0; i< certificate.length; i++) {
for (int i = 0; i < certificate.length; i++) {
streams[i] = (getClass().getResourceAsStream(certificate[i]));
}
return new ServerKey(streams).getTrustStore();
Expand All @@ -68,4 +67,4 @@ private X509Certificate getEETCertificate(final String path) throws CertificateE
final CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
return (X509Certificate) certificateFactory.generateCertificate(is);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SecurityCodesGeneratorTest {
@Before
public void setUp() throws Exception {
testData = Arrays.asList(
new DemoRequestHolder("/keys/CZ1212121218.p12", "eet", "/requests/CZ1212121218.valid.v3.1.xml"),
new DemoRequestHolder("/keys/CZ683555118.p12", "eet", "/requests/CZ683555118.valid.v3.1.xml"),
new DemoRequestHolder("/keys/CZ00000019.p12", "eet", "/requests/CZ00000019.valid.v3.1.xml")
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CertificateUtilsTest {
@Test
public void testServerKeyInfo() throws Exception {
final X509Certificate x509Certificate = getCertificate("/keys/crls-demo-cert.pem");
Assert.assertEquals("{subject='SERIALNUMBER=ICA - 10461704, OID.2.5.4.97=NTRCZ-72080043, O=Česká republika - Generální finanční ředitelství, C=CZ, CN=Elektronická evidence tržeb - Playground', issuer='SERIALNUMBER=NTRCZ-26439395, O=\"První certifikační autorita, a.s.\", CN=I.CA Qualified 2 CA/RSA 02/2016, C=CZ', SerialNumber=11390220, validFrom=2018-05-24T10:42:21+02:00, validTo=2019-05-24T10:42:21+02:00}", CertificateUtils.getCertificateInfo(x509Certificate));
Assert.assertEquals("{subject='O=Generální finanční ředitelství, CN=GFR EET test CA 1, C=CZ', issuer='O=Generální finanční ředitelství, CN=GFR EET test CA 1, C=CZ', SerialNumber=16777216, validFrom=2016-05-02T13:52:28+02:00, validTo=2026-04-30T13:52:28+02:00}", CertificateUtils.getCertificateInfo(x509Certificate));

}

Expand All @@ -39,4 +39,4 @@ private X509Certificate getCertificate(final String path) throws CertificateExce
return (X509Certificate) certificateFactory.generateCertificate(is);
}

}
}
Binary file modified src/test/resources/keys/CZ00000019.p12
Binary file not shown.
Binary file modified src/test/resources/keys/CZ683555118.p12
Binary file not shown.
87 changes: 85 additions & 2 deletions src/test/resources/keys/crls-demo-cert.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 16777216 (0x1000000)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=CZ, CN=GFR EET test CA 1, O=Gener\xC3\xA1ln\xC3\xAD finan\xC4\x8Dn\xC3\xAD \xC5\x99editelstv\xC3\xAD
Validity
Not Before: May 2 11:52:28 2016 GMT
Not After : Apr 30 11:52:28 2026 GMT
Subject: C=CZ, CN=GFR EET test CA 1, O=Gener\xC3\xA1ln\xC3\xAD finan\xC4\x8Dn\xC3\xAD \xC5\x99editelstv\xC3\xAD
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:cd:8d:c9:1c:79:aa:2c:14:88:cb:b1:2f:24:36:
27:dd:07:d7:95:da:9f:fb:2e:37:46:6c:c1:28:af:
41:13:a2:97:1a:f6:20:9b:25:f8:f0:27:87:37:4d:
18:c5:c8:cb:e5:ee:9b:54:45:c0:79:76:02:b1:b0:
e5:18:d5:c2:f1:83:59:32:10:ae:34:5d:39:cb:cc:
81:ec:7c:93:a8:85:58:93:18:ee:b3:12:b7:95:3a:
7e:44:20:88:5d:15:e1:3f:42:bc:2c:e7:3a:03:93:
db:51:b3:d4:66:14:d1:81:e4:e6:77:82:bc:e4:db:
a5:6f:b0:36:77:4e:f3:8b:f7:c7:3c:a2:87:4e:bb:
a1:2e:30:4d:63:ad:c2:4d:a0:5b:a1:9f:86:3a:51:
a3:bc:7b:bc:f5:ce:a9:f3:10:82:89:68:d2:36:8e:
9d:6a:0b:22:5b:50:a1:17:86:21:30:8d:81:fe:1e:
80:98:e2:8f:ad:bb:93:16:2b:c8:58:4e:61:b9:4e:
ca:ac:95:84:ed:ef:4b:b2:04:6f:e8:89:da:85:9e:
7e:68:44:36:04:4b:e0:f7:b4:44:b2:65:a4:87:e8:
49:87:13:68:81:ed:f8:5c:47:41:a3:0b:86:6b:21:
c0:98:21:e2:1c:e3:8c:0c:27:1e:3e:d3:8c:b4:a5:
09:b9
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 Subject Alternative Name:
email:[email protected]
X509v3 Certificate Policies:
Policy: 2.16.840.1.101.3.2.1.48.1
User Notice:
Explicit Text: Tato CA je pouze TESTOVACI

X509v3 Subject Key Identifier:
7A:5A:FC:0D:CB:EC:36:A6:0D:DA:69:19:66:8C:9B:EF:82:C3:A9:34
Signature Algorithm: sha256WithRSAEncryption
bc:7f:58:bb:0f:e5:e9:70:05:c4:9e:86:37:52:75:24:17:14:
38:6b:7d:e1:f0:79:71:14:02:86:52:c0:4e:1d:6f:d9:81:53:
fc:07:8d:41:84:24:7e:ec:9c:db:ad:f8:16:35:85:94:6c:4e:
13:05:84:bf:25:6a:cd:9b:84:30:50:ec:b6:50:1f:27:02:ef:
00:6f:86:c3:77:9d:9e:10:d9:11:88:2b:b2:d2:49:13:eb:7e:
43:62:d7:16:41:e6:e6:d9:a8:ef:12:bd:1f:4e:8b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