瀏覽代碼

Fix matchingId encoding when authenticating server to eUICC

Because the library uses hex-encoded string internally for all APDU
commands, the matchingId itself also needs to be encoded. This is done
by `setMatchingId` and we should also use that when generating
CtxParams1 ourselves.
Peter Cai 3 年之前
父節點
當前提交
cbe3fd1458

+ 0 - 1
libs/lpad-sm-dp-plus-connector/src/main/java/com/truphone/lpa/impl/DownloadProfileWorker.kt

@@ -74,7 +74,6 @@ internal class DownloadProfileWorker(
         )
         )
         authenticatingPhaseWorker.initiateAuthentication(
         authenticatingPhaseWorker.initiateAuthentication(
             initialAuthenticationKeys,
             initialAuthenticationKeys,
-            matchingId,
             imei
             imei
         )
         )
         downloadAndInstallProfilePackage(
         downloadAndInstallProfilePackage(

+ 4 - 4
libs/lpad-sm-dp-plus-connector/src/main/java/com/truphone/lpa/impl/download/AuthenticatingPhaseWorker.java

@@ -125,7 +125,7 @@ public class AuthenticatingPhaseWorker {
         }
         }
     }
     }
 
 
-    public void initiateAuthentication(InitialAuthenticationKeys initialAuthenticationKeys, String matchingId, String imei) {
+    public void initiateAuthentication(InitialAuthenticationKeys initialAuthenticationKeys, String imei) {
 
 
         progress.stepExecuted(DOWNLOAD_PROFILE_INITIATE_AUTHENTICATION, "initiateAuthentication retrieving...");
         progress.stepExecuted(DOWNLOAD_PROFILE_INITIATE_AUTHENTICATION, "initiateAuthentication retrieving...");
 
 
@@ -141,14 +141,14 @@ public class AuthenticatingPhaseWorker {
         setServerCertificate(initialAuthenticationKeys, initiateAuthenticationResp);
         setServerCertificate(initialAuthenticationKeys, initiateAuthenticationResp);
         setTransactionId(initialAuthenticationKeys, initiateAuthenticationResp);
         setTransactionId(initialAuthenticationKeys, initiateAuthenticationResp);
         setMatchingId(initialAuthenticationKeys);
         setMatchingId(initialAuthenticationKeys);
-        setCtxParams1(initialAuthenticationKeys, matchingId, imei);
+        setCtxParams1(initialAuthenticationKeys, imei);
 
 
         progress.stepExecuted(DOWNLOAD_PROFILE_INITIATED_AUTHENTICATION, "initiateAuthentication initiated...");
         progress.stepExecuted(DOWNLOAD_PROFILE_INITIATED_AUTHENTICATION, "initiateAuthentication initiated...");
     }
     }
 
 
-    private void setCtxParams1(InitialAuthenticationKeys initialAuthenticationKeys, String matchingId, String imei) {
+    private void setCtxParams1(InitialAuthenticationKeys initialAuthenticationKeys, String imei) {
 
 
-        initialAuthenticationKeys.setCtxParams1(ApduUtils.generateCtxParams1(matchingId, imei));
+        initialAuthenticationKeys.setCtxParams1(ApduUtils.generateCtxParams1(initialAuthenticationKeys.getMatchingId(), imei));
 
 
         if (LogStub.getInstance().isDebugEnabled()) {
         if (LogStub.getInstance().isDebugEnabled()) {
             LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - ctxParams1: " + initialAuthenticationKeys.getCtxParams1());
             LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - ctxParams1: " + initialAuthenticationKeys.getCtxParams1());