Skip to content

Commit c76eacd

Browse files
R2.5.1
1 parent 5960d4f commit c76eacd

14 files changed

Lines changed: 93 additions & 36 deletions

File tree

ReleaseNotes.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
# Release Notes popp-sample-code
44

55
### Known Issues
6-
- If your eGK has an older CVCA you may get problems while testing with the RÍSE PoPP-Service
76
- Standard-Kartenleser with Docker is not supported
87

8+
## Release 2.5.1
9+
10+
### fixed
11+
- contact(less)-virtual now uses correct SubCA CVC from card image used
12+
913
## Release 2.5.0
1014

1115
### added

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</parent>
88
<groupId>de.gematik.refpopp</groupId>
99
<artifactId>popp-example-impl-global</artifactId>
10-
<version>2.5.0</version>
10+
<version>2.5.1</version>
1111
<packaging>pom</packaging>
1212
<name>popp-sample-code</name>
1313
<description>PoPP - example implementation</description>
@@ -65,7 +65,7 @@
6565
<version.maven-clean-plugin>3.5.0</version.maven-clean-plugin>
6666
<version.maven-compiler-plugin>3.15.0</version.maven-compiler-plugin>
6767
<version.maven-enforcer-plugin>3.6.3</version.maven-enforcer-plugin>
68-
<version.maven-failsafe-plugin>3.5.5</version.maven-failsafe-plugin>
68+
<version.maven-failsafe-plugin>3.5.6</version.maven-failsafe-plugin>
6969
<version.maven-gpg-plugin>3.2.8</version.maven-gpg-plugin>
7070
<version.maven-javadoc-plugin>3.12.0</version.maven-javadoc-plugin>
7171
<version.maven-project-info-reports-plugin>3.9.0</version.maven-project-info-reports-plugin>
@@ -74,11 +74,11 @@
7474
<version.maven-site-plugin>3.22.0</version.maven-site-plugin>
7575
<!-- settings for upload to sonar server -->
7676
<version.maven-source-plugin>3.4.0</version.maven-source-plugin>
77-
<version.maven-surefire-plugin>3.5.5</version.maven-surefire-plugin>
77+
<version.maven-surefire-plugin>3.5.6</version.maven-surefire-plugin>
7878
<version.central-publishing-maven-plugin>0.10.0</version.central-publishing-maven-plugin>
7979
<version.openhealth.healthcard>0.4.0-alpha1</version.openhealth.healthcard>
80-
<version.sonar-maven-plugin>5.6.0.6792</version.sonar-maven-plugin>
81-
<version.spotless-maven-plugin>3.5.1</version.spotless-maven-plugin>
80+
<version.sonar-maven-plugin>5.7.0.6970</version.sonar-maven-plugin>
81+
<version.spotless-maven-plugin>3.6.0</version.spotless-maven-plugin>
8282
<version.spotless.google-java-format>1.27.0</version.spotless.google-java-format>
8383
<version.spring-boot-maven-plugin>3.3.2</version.spring-boot-maven-plugin>
8484
<version.zeta-sdk-jvm>1.0.1</version.zeta-sdk-jvm>

popp-client/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>de.gematik.refpopp</groupId>
99
<artifactId>popp-example-impl-global</artifactId>
10-
<version>2.5.0</version>
10+
<version>2.5.1</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

@@ -152,7 +152,7 @@
152152
<dependency>
153153
<groupId>com.nimbusds</groupId>
154154
<artifactId>nimbus-jose-jwt</artifactId>
155-
<version>10.9</version>
155+
<version>10.9.1</version>
156156
</dependency>
157157
</dependencies>
158158

@@ -222,7 +222,7 @@
222222
<plugin>
223223
<groupId>org.apache.maven.plugins</groupId>
224224
<artifactId>maven-dependency-plugin</artifactId>
225-
<version>3.10.0</version>
225+
<version>3.11.0</version>
226226
<executions>
227227
<execution>
228228
<id>unpack-openhealth-linux-natives</id>

popp-client/src/main/java/de/gematik/refpopp/popp_client/PoppClientApplication.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,25 @@
2020

2121
package de.gematik.refpopp.popp_client;
2222

23+
import lombok.extern.slf4j.Slf4j;
24+
import org.springframework.beans.factory.annotation.Value;
2325
import org.springframework.boot.SpringApplication;
2426
import org.springframework.boot.autoconfigure.SpringBootApplication;
27+
import org.springframework.boot.context.event.ApplicationReadyEvent;
28+
import org.springframework.context.event.EventListener;
2529

30+
@Slf4j
2631
@SpringBootApplication(scanBasePackages = "de.gematik.refpopp.popp_client")
2732
public class PoppClientApplication {
2833

34+
@Value("${popp-server.url}")
35+
private String poppServerUrl;
36+
37+
@EventListener(ApplicationReadyEvent.class)
38+
public void onApplicationReady() {
39+
log.info("### PoPP Service: {}", poppServerUrl);
40+
}
41+
2942
public static void main(final String[] args) {
3043
SpringApplication.run(PoppClientApplication.class, args);
3144
}

popp-client/src/main/java/de/gematik/refpopp/popp_client/cardreader/card/VirtualCardService.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public class VirtualCardService {
9191

9292
public static final String APDU_RESPONSE_OK = "9000";
9393

94-
public static final String APDU_RESPONSE_READ_VERSION =
95-
"ef2bc003020000c103040502c210444549444d4548435f39303030030005c403010000c503020000c703010000";
96-
public static final String APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE =
97-
"7f2181d87f4e81915f290170420844454758588702227f494d06082a8648ce3d04030286410428405a0ccc5c53b6780356a5141eb47fed5f56be44bc22f2046fc053fedbc25e50e24a6d6af95c1cfee9497acce359a253f7d0b7abaea5d1a62de030145f0c975f200844454758581102237f4c1306082a8214004c0481185307800000000000005f25060203000703015f24060301000703005f37404cd260c0803b125a001ba81ba9f2e2b1390de4f14691c822a28cc776a186d7ba7f08704c27fdcdaeb1f8b243a37976cf37bf7c121858d0f0419de83217a395de";
9894
public static final String APDU_RESPONSE_RETRIEVE_PUBLIC_KEY_IDENTIFIERS =
9995
"e0154f07d2760001448000b60a83084445475858870222e0154f07d2760001448000b60a83084445475858120223e0194f07d2760001448000a40e830c000a80276001011699902101e0194f07d2760001448000a40e830c4d6f7270686f414343455353e0164f07d2760001448000b60b83094d6f7270686f564552e0154f07d2760001448000b60a83084445475858860220e0154f07d2760001448000b60a83080000000000000013";
10096
private static final String APDU_SELECT_MASTER_FILE =
@@ -152,6 +148,8 @@ public class VirtualCardService {
152148
private String apduReadEndEntityCvCertificate;
153149
private String apduMutualAuthenticationStep1;
154150
private String apduReadEfCChAutE256;
151+
private String subCaCvCertificate;
152+
private String version2;
155153

156154
private static final byte[] EMPTY_BYTES = new byte[0];
157155

@@ -188,9 +186,8 @@ public VirtualCardService(
188186
this.apduReadEfCChAutE256 = normalize(apduReadEfCChAutE256);
189187

190188
registerStaticApduResponse(apduSelectMasterFile, "");
191-
registerStaticApduResponse(apduReadVersion, APDU_RESPONSE_READ_VERSION);
192-
registerStaticApduResponse(
193-
apduReadSubCaCvCertificate, APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE);
189+
registerStaticApduResponse(apduReadVersion, version2);
190+
registerStaticApduResponse(apduReadSubCaCvCertificate, subCaCvCertificate);
194191
registerStaticApduResponse(
195192
apduRetrievePublicKeyIdentifiers, APDU_RESPONSE_RETRIEVE_PUBLIC_KEY_IDENTIFIERS);
196193
registerStaticApduResponse(apduSelectPrivateKey, "");
@@ -214,6 +211,10 @@ public void loadCardImage(String imageFile) {
214211
log.info("| CV certificate: " + cvCertificate);
215212
authCertificate = getCertificateData(xmlString, "EF.C.CH.AUT.E256");
216213
log.info("| X.509 certificate: " + authCertificate);
214+
subCaCvCertificate = getCertificateData(xmlString, "EF.C.CA_eGK.CS.E256");
215+
log.info("| Sub-CA CV certificate: " + subCaCvCertificate);
216+
version2 = getCertificateData(xmlString, "EF.Version2");
217+
log.info("| EF.Version2: " + version2);
217218
egkAuthCvcPrivateKey = loadEgkAuthCvcPrivateKey(xmlString);
218219
} catch (IOException | SAXException | ParserConfigurationException e) {
219220
throw new RuntimeException("Error when loading XML card image file", e);
@@ -310,10 +311,10 @@ private String resolveStaticResponse(final String normalizedCommandApdu) {
310311
return "";
311312
}
312313
if (normalizedCommandApdu.equals(APDU_READ_VERSION)) {
313-
return APDU_RESPONSE_READ_VERSION;
314+
return version2;
314315
}
315316
if (normalizedCommandApdu.equals(APDU_READ_SUB_CA_CV_CERTIFICATE)) {
316-
return APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE;
317+
return subCaCvCertificate;
317318
}
318319
if (normalizedCommandApdu.equals(APDU_RETRIEVE_PUBLIC_KEY_IDENTIFIERS)) {
319320
return APDU_RESPONSE_RETRIEVE_PUBLIC_KEY_IDENTIFIERS;

popp-client/src/main/java/de/gematik/refpopp/popp_client/client/ClientServerCommunicationService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public void connect() {
5353
log.info("| Websocket client is closed");
5454
try {
5555
secureWebSocketClient.connectBlocking();
56-
} catch (final Exception e) {
56+
} catch (final RuntimeException e) {
5757
log.error("Error connecting to WebSocket server: {}", e.getMessage(), e);
58-
Thread.currentThread().interrupt();
58+
throw e;
5959
}
6060
}
6161

popp-client/src/main/java/de/gematik/refpopp/popp_client/client/SecureWebSocketClient.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public class SecureWebSocketClient {
7979
private final ExecutorService pool;
8080
private final CountDownLatch sessionReady = new CountDownLatch(1);
8181
private final AtomicReference<WsClientExtension.WsSession> session = new AtomicReference<>();
82+
private final AtomicReference<Throwable> connectError = new AtomicReference<>();
8283
private final Map<String, Object> sessionMetadata;
8384
private final WsClientWrapper wsClientWrapper;
8485

@@ -207,7 +208,8 @@ public boolean isOpen() {
207208

208209
public void connectBlocking() {
209210
pool.submit(
210-
() ->
211+
() -> {
212+
try {
211213
wsClientWrapper.ws(
212214
zetaSdk,
213215
this.serverUri.toString(),
@@ -234,12 +236,23 @@ public void connectBlocking() {
234236
log.debug("WebSocket received binary (bytes): {}", bin.getBytes().length);
235237
}
236238
}
237-
}));
239+
});
240+
} catch (final Throwable t) {
241+
connectError.set(t);
242+
log.error("WebSocket connect failed: {}", t.getMessage(), t);
243+
sessionReady.countDown();
244+
}
245+
});
238246

239247
try {
240-
if (!sessionReady.await(10, TimeUnit.SECONDS)) {
248+
if (!sessionReady.await(150, TimeUnit.SECONDS)) {
241249
throw new RuntimeException("Connection timeout");
242250
}
251+
final Throwable cause = connectError.get();
252+
if (cause != null) {
253+
throw new RuntimeException(
254+
"Failed to establish WebSocket connection: " + cause.getMessage(), cause);
255+
}
243256
} catch (InterruptedException e) {
244257
Thread.currentThread().interrupt();
245258
throw new IllegalStateException(

popp-client/src/main/resources/application-dev-local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ connector:
1717
clientSystemId: ${CONTEXT_CLIENT_SYSTEM_ID:C1}
1818
workplaceId: ${CONTEXT_WORKPLACE_ID:W1}
1919
mandantId: ${CONTEXT_MANDANT_ID:M1}
20-
ct-id: "" # Identifikation des Kartenterminals
20+
ct-id: ${CARD_TERMINAL_ID:ktId} # Identifikation des Kartenterminals
2121

2222
zeta:
2323
client:

popp-client/src/test/java/de/gematik/refpopp/popp_client/cardreader/card/VirtualCardServiceTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class VirtualCardServiceTest {
5555
private static final String GENERAL_AUTHENTICATE_STEP_2 =
5656
"00 86 0000 45"
5757
+ " 7c43854104987fce93bfc191e4db006b56f8fd5f749d256fc5842f0f3f31becf613ce146f66318f77ff7ee51c10b6b6a0f349896400c7601bfc07608ff08fe0ce1d921ca42";
58+
private static final String APDU_RESPONSE_READ_VERSION =
59+
"ef2bc003020000c103040502c21045474b5f47322e312020202020040502c403010000c503020000c703010000";
60+
private static final String APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE =
61+
"7F2181D87F4E81915F290170420844454758588702227F494D06082A8648CE3D04030286410428405A0CCC5C53B6780356A5141EB47FED5F56BE44BC22F2046FC053FEDBC25E50E24A6D6AF95C1CFEE9497ACCE359A253F7D0B7ABAEA5D1A62DE030145F0C975F200844454758581102237F4C1306082A8214004C0481185307800000000000005F25060203000703015F24060301000703005F37404CD260C0803B125A001BA81BA9F2E2B1390DE4F14691C822A28CC776A186D7BA7F08704C27FDCDAEB1F8B243A37976CF37BF7C121858D0F0419DE83217A395DE";
5862

5963
private VirtualCardService virtualCardService;
6064

@@ -181,17 +185,15 @@ void processReturnsStaticAndDynamicResponsesAndReportsConfiguredState() {
181185
.endsWith(VirtualCardService.APDU_RESPONSE_OK);
182186
Assertions.assertThat(responses.get(2))
183187
.isEqualTo("AUTH_CERT" + VirtualCardService.APDU_RESPONSE_OK);
184-
Assertions.assertThat(responses.get(3))
185-
.isEqualTo(
186-
VirtualCardService.APDU_RESPONSE_READ_VERSION + VirtualCardService.APDU_RESPONSE_OK);
187188
Assertions.assertThat(responses.get(4)).isEqualTo(VirtualCardService.APDU_RESPONSE_OK);
188189
}
189190

190191
@Test
191192
void processSupportsOpenHealthDefaultsWithoutConfiguredCommandApdus() {
192193
final var eventPublisher = mock(ApplicationEventPublisher.class);
193194
final var service =
194-
new VirtualCardService(eventPublisher, "", "", "", "", "", "", "", "", "", "", "");
195+
new VirtualCardService(
196+
eventPublisher, "IMG_eGK_G21_TU_root6 1.xml", "", "", "", "", "", "", "", "", "", "");
195197
service.setCvCertificate("CV_CERT");
196198
service.setAuthCertificate("AUTH_CERT");
197199

@@ -211,12 +213,9 @@ void processSupportsOpenHealthDefaultsWithoutConfiguredCommandApdus() {
211213

212214
Assertions.assertThat(responses.get(0)).isEqualTo(VirtualCardService.APDU_RESPONSE_OK);
213215
Assertions.assertThat(responses.get(1))
214-
.isEqualTo(
215-
VirtualCardService.APDU_RESPONSE_READ_VERSION + VirtualCardService.APDU_RESPONSE_OK);
216+
.isEqualTo(APDU_RESPONSE_READ_VERSION + VirtualCardService.APDU_RESPONSE_OK);
216217
Assertions.assertThat(responses.get(2))
217-
.isEqualTo(
218-
VirtualCardService.APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE
219-
+ VirtualCardService.APDU_RESPONSE_OK);
218+
.isEqualTo(APDU_RESPONSE_READ_SUB_CA_CV_CERTIFICATE + VirtualCardService.APDU_RESPONSE_OK);
220219
Assertions.assertThat(responses.get(3))
221220
.isEqualTo(
222221
VirtualCardService.APDU_RESPONSE_RETRIEVE_PUBLIC_KEY_IDENTIFIERS

popp-client/src/test/java/de/gematik/refpopp/popp_client/client/SecureWebSocketClientTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ void testConnectBlockingTimeout() throws Exception {
234234
assertThat(ex).hasMessage("Connection timeout");
235235
}
236236

237+
@Test
238+
void connectBlockingRethrowsConnectErrorFromWorkerThread() {
239+
// given
240+
final var connectionException = new RuntimeException("Service discovery failed");
241+
doThrow(connectionException)
242+
.when(wsClientWrapperMock)
243+
.ws(any(), anyString(), any(), anyMap(), any());
244+
245+
// when / then
246+
assertThatThrownBy(() -> sut.connectBlocking())
247+
.isInstanceOf(RuntimeException.class)
248+
.hasMessage("Failed to establish WebSocket connection: Service discovery failed")
249+
.hasCause(connectionException);
250+
}
251+
237252
@Test
238253
void testConnectBlockingInterrupted() throws Exception {
239254
// given

0 commit comments

Comments
 (0)