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.
This commit is contained in:
Peter Cai 2022-05-19 22:30:58 -04:00
parent a6e59c3d27
commit cbe3fd1458
2 changed files with 4 additions and 5 deletions

View file

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

View file

@ -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());