Skip to content

Commit 9fd984c

Browse files
authored
Disable designated OCSP responder tests that depend on hardwired certificates and revert attempt to use the newer OCSP responder certificate from ebd6985 (#42)
As new designated test OCSP responder certificates are issued more frequently now, it is no longer feasible to keep the certificates up to date. WE2-764 Signed-off-by: Mart Somermaa <[email protected]> Co-authored-by: Mart Somermaa <[email protected]>
1 parent ecb36cd commit 9fd984c

9 files changed

+14
-13
lines changed

pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<jackson.version>2.13.4.2</jackson.version>
1919
<slf4j.version>1.7.36</slf4j.version>
2020
<bouncycastle.version>1.70</bouncycastle.version>
21-
<guava.version>31.1-jre</guava.version>
2221
<okhttp.version>4.10.0</okhttp.version>
2322
<junit-jupiter.version>5.8.2</junit-jupiter.version>
2423
<assertj.version>3.23.1</assertj.version>

src/test/java/eu/webeid/security/testutil/Certificates.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ public class Certificates {
4141
private static X509Certificate jaakKristjanEsteid2018Cert;
4242
private static X509Certificate mariliisEsteid2015Cert;
4343
private static X509Certificate organizationCert;
44-
private static X509Certificate testSkOcspResponder2023;
44+
private static X509Certificate testSkOcspResponder2020;
4545

4646
static void loadCertificates() throws CertificateException, IOException {
47-
X509Certificate[] certificates = CertificateLoader.loadCertificatesFromResources("TEST_of_ESTEID-SK_2015.cer", "TEST_of_ESTEID2018.cer", "TEST_of_ESTEID-SK_2018_AIA_OCSP_RESPONDER_202304.der");
47+
X509Certificate[] certificates = CertificateLoader.loadCertificatesFromResources("TEST_of_ESTEID-SK_2015.cer", "TEST_of_ESTEID2018.cer", "TEST_of_SK_OCSP_RESPONDER_2020.cer");
4848
testEsteid2015CA = certificates[0];
4949
testEsteid2018CA = certificates[1];
50-
testSkOcspResponder2023 = certificates[2];
50+
testSkOcspResponder2020 = certificates[2];
5151
}
5252

5353
public static X509Certificate getTestEsteid2018CA() throws CertificateException, IOException {
@@ -64,11 +64,11 @@ public static X509Certificate getTestEsteid2015CA() throws CertificateException,
6464
return testEsteid2015CA;
6565
}
6666

67-
public static X509Certificate getTestSkOcspResponder2023() throws CertificateException, IOException {
68-
if (testSkOcspResponder2023 == null) {
67+
public static X509Certificate getTestSkOcspResponder2020() throws CertificateException, IOException {
68+
if (testSkOcspResponder2020 == null) {
6969
loadCertificates();
7070
}
71-
return testSkOcspResponder2023;
71+
return testSkOcspResponder2020;
7272
}
7373

7474
public static X509Certificate getJaakKristjanEsteid2018Cert() throws CertificateDecodingException {

src/test/java/eu/webeid/security/testutil/OcspServiceMaker.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private static DesignatedOcspServiceConfiguration getDesignatedOcspServiceConfig
9393
private static DesignatedOcspServiceConfiguration getDesignatedOcspServiceConfiguration(boolean doesSupportNonce, String ocspServiceAccessLocation) throws CertificateException, IOException, OCSPCertificateException {
9494
return new DesignatedOcspServiceConfiguration(
9595
URI.create(ocspServiceAccessLocation),
96-
getTestSkOcspResponder2023(),
96+
getTestSkOcspResponder2020(),
9797
TRUSTED_CA_CERTIFICATES,
9898
doesSupportNonce);
9999
}

src/test/java/eu/webeid/security/validator/AuthTokenCertificateTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ void whenTrustedCACertificateIsNoLongerValid_thenValidationFails() {
244244
}
245245

246246
@Test
247+
@Disabled("A new designated test OCSP responder certificate was issued whose validity period no longer overlaps with the revoked certificate")
247248
void whenCertificateIsRevoked_thenOcspCheckFails() throws Exception {
248249
mockDate("2020-01-01");
249250
final AuthTokenValidator validatorWithOcspCheck = AuthTokenValidators.getAuthTokenValidatorWithOcspCheck();

src/test/java/eu/webeid/security/validator/AuthTokenStructureTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
package eu.webeid.security.validator;
2424

25-
import eu.webeid.security.testutil.AbstractTestWithValidator;
26-
import org.junit.jupiter.api.Test;
2725
import eu.webeid.security.authtoken.WebEidAuthToken;
28-
import eu.webeid.security.exceptions.AuthTokenParseException;
2926
import eu.webeid.security.exceptions.AuthTokenException;
27+
import eu.webeid.security.exceptions.AuthTokenParseException;
28+
import eu.webeid.security.testutil.AbstractTestWithValidator;
29+
import org.junit.jupiter.api.Test;
3030

3131
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3232

src/test/java/eu/webeid/security/validator/certvalidators/SubjectCertificateNotRevokedValidatorTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ void whenValidAiaOcspResponderConfiguration_thenSucceeds() throws Exception {
8181
}
8282

8383
@Test
84+
@Disabled("As new designated test OCSP responder certificates are issued more frequently now, it is no longer feasible to keep the certificates up to date")
8485
void whenValidDesignatedOcspResponderConfiguration_thenSucceeds() throws Exception {
8586
final OcspServiceProvider ocspServiceProvider = getDesignatedOcspServiceProvider();
8687
final SubjectCertificateNotRevokedValidator validator = new SubjectCertificateNotRevokedValidator(trustedValidator, ocspClient, ocspServiceProvider);
@@ -90,6 +91,7 @@ void whenValidDesignatedOcspResponderConfiguration_thenSucceeds() throws Excepti
9091
}
9192

9293
@Test
94+
@Disabled("As new designated test OCSP responder certificates are issued more frequently now, it is no longer feasible to keep the certificates up to date")
9395
void whenValidOcspNonceDisabledConfiguration_thenSucceeds() throws Exception {
9496
final OcspServiceProvider ocspServiceProvider = getDesignatedOcspServiceProvider(false);
9597
final SubjectCertificateNotRevokedValidator validator = new SubjectCertificateNotRevokedValidator(trustedValidator, ocspClient, ocspServiceProvider);
@@ -238,7 +240,6 @@ void whenOcspResponseRevoked_thenThrows() throws Exception {
238240
}
239241

240242
@Test
241-
@Disabled("A new designated test OCSP responder certificate was issued so the responder certificate in ocsp_response_unknown.der is no longer valid")
242243
void whenOcspResponseUnknown_thenThrows() throws Exception {
243244
final OcspServiceProvider ocspServiceProvider = getDesignatedOcspServiceProvider("https://web-eid-test.free.beeceptor.com");
244245
try (final Response response = getResponseBuilder()

src/test/java/eu/webeid/security/validator/ocsp/OcspServiceProviderTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void whenDesignatedOcspServiceConfigurationProvided_thenCreatesDesignatedOcspSer
4444
assertThat(service.getAccessLocation()).isEqualTo(new URI("http://demo.sk.ee/ocsp"));
4545
assertThat(service.doesSupportNonce()).isTrue();
4646
assertThatCode(() ->
47-
service.validateResponderCertificate(new X509CertificateHolder(getTestSkOcspResponder2023().getEncoded()), new Date(1681000000000L)))
47+
service.validateResponderCertificate(new X509CertificateHolder(getTestSkOcspResponder2020().getEncoded()), new Date(1630000000000L)))
4848
.doesNotThrowAnyException();
4949
assertThatCode(() ->
5050
service.validateResponderCertificate(new X509CertificateHolder(getTestEsteid2018CA().getEncoded()), new Date(1630000000000L)))
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)