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(
initialAuthenticationKeys,
matchingId,
imei
)
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...");
@ -141,14 +141,14 @@ public class AuthenticatingPhaseWorker {
setServerCertificate(initialAuthenticationKeys, initiateAuthenticationResp);
setTransactionId(initialAuthenticationKeys, initiateAuthenticationResp);
setMatchingId(initialAuthenticationKeys);
setCtxParams1(initialAuthenticationKeys, matchingId, imei);
setCtxParams1(initialAuthenticationKeys, imei);
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()) {
LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - ctxParams1: " + initialAuthenticationKeys.getCtxParams1());