@@ -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 ;
0 commit comments