dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43144?usp=email )
Change subject: WIP: add ESipa JSON encoder/decoder module ......................................................................
WIP: add ESipa JSON encoder/decoder module
In order to test an eIM (or IPAd), which uses the JSON ESipa bindings instead of the ASN.1 ESipa bindings a set of encoder/decoder functions is needed to generate/parse the JSON messages exchanged on the ESipa interface
TODO: there are a lot of changes to SGP32Definitions_Templates.ttcn, split them in smaller more reviewable patches.
Change-Id: I8b6a87f39ca23658d980d19cf257b8994ea1cecb Related: SYS#8100 --- M eim/eIM_Tests.ttcn M eim/gen_links.sh M ipad/IPAd_Tests.ttcn M library/euicc/RSPDefinitions_Templates.ttcn M library/euicc/RSPDefinitions_Types.ttcn M library/euicc/SGP32Definitions_Templates.ttcn M library/euicc/SGP32Definitions_Types.ttcn A library/euicc/esipa_Types_JSON.ttcn 8 files changed, 929 insertions(+), 257 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/44/43144/1
diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn index 8728082..99d58bf 100644 --- a/eim/eIM_Tests.ttcn +++ b/eim/eIM_Tests.ttcn @@ -490,7 +490,7 @@ /* Check the eIM for new eIM packages, we expect to get a profileDownloadTriggerRequest that contains the * activationCode that we have created the download with (see above) */ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(eID)), - tr_getEimPackageResponse_dnlTrigReq(activationCode)); + tr_getEimPackageResponse_dnlTrigReq(tr_profileDownloadTriggerRequest(activationCode))); eimTransactionId := valueof(esipa_res.getEimPackageResponse.profileDownloadTriggerRequest.eimTransactionId);
/* Perform common mutial authentication procedure */ @@ -502,7 +502,7 @@ f_esipa_receive(tr_getBoundProfilePackageResponseEsipa);
/* Handle notification */ - f_esipa_send(valueof(ts_handleNotificationEsipa_prfleInstRslt(notificationAddress := smdpp_add))); + f_esipa_send(valueof(ts_handleNotificationEsipa_pendingNotif(ts_SGP32_pendingNotification_prfleInstRslt(notificationAddress := smdpp_add)))); f_es9p_transceive_empty_response(tr_handleNotification);
f_rest_lookup_resource(resource_id, "download", tr_JSON_REST_success); @@ -548,7 +548,7 @@ /* Check the eIM for new eIM packages, we expect to get an euiccPackageRequest that contains the PSMO * that we have created (see above) */ esipa_res := f_esipa_transceive(valueof(ts_getEimPackageRequest(str2oct(order.eidValue))), - tr_getEimPackageResponse_euiccPkgReq(euiccPackage)); + tr_getEimPackageResponse_euiccPkgReq(tr_euiccPackageRequest(euiccPackage)));
/* The eIM will generate a counterValue and an eimTransactionId, both must be echoed in the response. */ euiccPackageResult.euiccPackageResultSigned.euiccPackageResultDataSigned.counterValue := @@ -557,7 +557,7 @@ esipa_res.getEimPackageResponse.euiccPackageRequest.euiccPackageSigned.eimTransactionId;
/* Respond with a plausible EimPackage result */ - f_esipa_transceive(valueof(ts_provideEimPackageResult_ePRAndNotif(eID, euiccPackageResult)), + f_esipa_transceive(valueof(ts_provideEimPackageResult(eID, ts_eimPackageResult_ePRAndNotif(euiccPackageResult))), tr_provideEimPackageResultResponse_empty);
f_rest_lookup_resource(resource_id, facility, tr_JSON_REST_success); @@ -833,7 +833,7 @@ eimTransactionId := valueof(esipa_res.getEimPackageResponse.ipaEuiccDataRequest.eimTransactionId);
/* Provide a plausible ipaEuiccDataResponse to the eIM */ - f_esipa_transceive(valueof(ts_provideEimPackageResult_euiccDataResp(eID, eimTransactionId)), + f_esipa_transceive(valueof(ts_provideEimPackageResult(eID, ts_eimPackageResult_euiccDataResp(eimTransactionId))), tr_provideEimPackageResultResponse_empty);
f_rest_lookup_resource(resource_id, "edr", tr_JSON_REST_success); @@ -876,7 +876,7 @@ eimTransactionId := valueof(esipa_res.getEimPackageResponse.ipaEuiccDataRequest.eimTransactionId);
/* Provide a plausible ipaEuiccDataResponse to the eIM */ - f_esipa_transceive(valueof(ts_provideEimPackageResult_euiccDataResp_err(eID, eimTransactionId)), + f_esipa_transceive(valueof(ts_provideEimPackageResult(eID, ts_eimPackageResult_euiccDataResp_err(eimTransactionId))), tr_provideEimPackageResultResponse_empty);
f_rest_lookup_resource(resource_id, "edr", tr_JSON_REST_success); diff --git a/eim/gen_links.sh b/eim/gen_links.sh index a8f91dd..91a67ea 100755 --- a/eim/gen_links.sh +++ b/eim/gen_links.sh @@ -34,7 +34,7 @@ FILES="PEDefinitions.asn PKIX1Explicit88.asn PKIX1Implicit88.asn RSPDefinitions.asn SGP32Definitions.asn " FILES+="PKIX1Explicit88_Templates.ttcn PKIX1Explicit88_Types.ttcn PKIX1Implicit88_Templates.ttcn " FILES+="PKIX1Implicit88_Types.ttcn RSPDefinitions_Templates.ttcn RSPDefinitions_Types.ttcn " -FILES+="SGP32Definitions_Templates.ttcn SGP32Definitions_Types.ttcn " +FILES+="SGP32Definitions_Templates.ttcn SGP32Definitions_Types.ttcn esipa_Types_JSON.ttcn " FILES+="es9p_Types_JSON.ttcn esx_header_Types_JSON.ttcn" gen_links $DIR $FILES
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn index c999cfb..ce744d0 100644 --- a/ipad/IPAd_Tests.ttcn +++ b/ipad/IPAd_Tests.ttcn @@ -409,7 +409,7 @@
/* Step #5-#10 */ esipa_req := f_esipa_receive(tr_initiateAuthenticationRequestEsipa); - esipa_res := valueof(ts_initiateAuthenticationResponseEsipa(euiccChallenge := esipa_req.initiateAuthenticationRequestEsipa.euiccChallenge)); + esipa_res := valueof(ts_initiateAuthenticationResponseEsipa(serverSigned1 := ts_serverSigned1(euiccChallenge := esipa_req.initiateAuthenticationRequestEsipa.euiccChallenge))); f_esipa_send(esipa_res);
/* Step #11-#14 */ @@ -482,7 +482,7 @@ f_vpcd_transceive(enc_ImmediateEnableResponse(valueof(ts_immediateEnableResponse)));
/* Receive ProfileInstallationResult from iPAD->eIM */ - f_esipa_transceive_empty_response(tr_handleNotificationEsipa_prfleInstRslt); + f_esipa_transceive_empty_response(tr_handleNotificationEsipa_pendingNotif(tr_SGP32_pendingNotification_prfleInstRslt));
/* Receive RemoveNotificationFromList from iPAD->eUICC */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -522,7 +522,7 @@
/* Step #10-14 */ f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), - tr_provideEimPackageResult_ePRAndNotif); + tr_provideEimPackageResult(*, tr_eimPackageResult_ePRAndNotif));
/* Step #15-17 */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -580,7 +580,7 @@
/* Step #10-14 */ f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), - tr_provideEimPackageResult_ePRAndNotif(euiccPackageResult := ?)); + tr_provideEimPackageResult(*, tr_eimPackageResult_ePRAndNotif(euiccPackageResult := ?)));
/* Step #15-17 */ f_vpcd_transceive(enc_NotificationSentResponse(valueof(ts_notificationSentResponse))); @@ -628,7 +628,7 @@
/* IPAd will return the data to us */ f_esipa_transceive(valueof(ts_provideEimPackageResultResponse_eimAck(eimAcknowledgements := {1,2,3,4})), - tr_provideEimPackageResult_euiccDataResp); + tr_provideEimPackageResult(*, tr_eimPackageResult_euiccDataResp));
/* Wait some time until the the last HTTP response is actually delivered */ f_sleep(2.0); diff --git a/library/euicc/RSPDefinitions_Templates.ttcn b/library/euicc/RSPDefinitions_Templates.ttcn index 8c3886e..b7ea50c 100644 --- a/library/euicc/RSPDefinitions_Templates.ttcn +++ b/library/euicc/RSPDefinitions_Templates.ttcn @@ -200,7 +200,7 @@ template (present) boolean ccRequiredFlag := ?) := { transactionId := transactionId, ccRequiredFlag := ccRequiredFlag, - bppEuiccOtpk := ? + bppEuiccOtpk := * } template (value) SmdpSigned2 ts_smdpSigned2(template (value) octetstring transactionId := 'ABCDEF'O, template (value) boolean ccRequiredFlag := false) := { diff --git a/library/euicc/RSPDefinitions_Types.ttcn b/library/euicc/RSPDefinitions_Types.ttcn index 5a33b45..d32a7f2 100644 --- a/library/euicc/RSPDefinitions_Types.ttcn +++ b/library/euicc/RSPDefinitions_Types.ttcn @@ -123,4 +123,9 @@ external function enc_NotificationMetadata(in NotificationMetadata msg) return octetstring with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
+external function dec_CtxParams1(in octetstring stream) return CtxParams1 +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_CtxParams1(in CtxParams1 msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + } diff --git a/library/euicc/SGP32Definitions_Templates.ttcn b/library/euicc/SGP32Definitions_Templates.ttcn index bdc5fba..336c906 100644 --- a/library/euicc/SGP32Definitions_Templates.ttcn +++ b/library/euicc/SGP32Definitions_Templates.ttcn @@ -83,37 +83,43 @@
/* GSMA SGP.32, section 6.3.2.1 */ template (present) EsipaMessageFromEimToIpa -tr_initiateAuthenticationResponseEsipa(template (present) octetstring euiccChallenge := ?, - template (present) universal charstring serverAddress := ?) := { +tr_initiateAuthenticationResponseEsipa(template octetstring transactionId := *, + template (present) ServerSigned1 serverSigned1 := tr_serverSigned1, + template (present) octetstring serverSignature1 := ?, + template (present) octetstring euiccCiPKIdentifierToBeUsed := ?, + template (present) Certificate serverCertificate := ?, + template charstring matchingId := *, + template CtxParams1 ctxParams1 := *) := { initiateAuthenticationResponseEsipa := { initiateAuthenticationOkEsipa := { - transactionId := *, - serverSigned1 := tr_serverSigned1(euiccChallenge := euiccChallenge, serverAddress := serverAddress), - serverSignature1 := ?, - euiccCiPKIdentifierToBeUsed := ?, + transactionId := transactionId, + serverSigned1 := serverSigned1, + serverSignature1 := serverSignature1, + euiccCiPKIdentifierToBeUsed := euiccCiPKIdentifierToBeUsed, serverCertificate := ?, - matchingId := *, - ctxParams1 := * + matchingId := matchingId, + ctxParams1 := ctxParams1 } } } - template (value) EsipaMessageFromEimToIpa -ts_initiateAuthenticationResponseEsipa(template (value) octetstring euiccChallenge := '00112233445566778899AABBCCDDEEFF'O, - template (value) universal charstring serverAddress := "smdp.example.com") := { +ts_initiateAuthenticationResponseEsipa(template (omit) octetstring transactionId := omit, + template (value) ServerSigned1 serverSigned1 := ts_serverSigned1, + template (value) octetstring serverSignature1 := '5252525252525252525252525252525252525252525252525252525252525252 + 5353535353535353535353535353535353535353535353535353535353535353'O, + template (value) octetstring euiccCiPKIdentifierToBeUsed := 'F54172BDF98A95D65CBEB88A38A1C11D800A85C3'O /* NIST */, + template (value) Certificate serverCertificate := ts_cert_s_sm_dpauth_nist, + template (omit) universal charstring matchingId := omit, + template (omit) CtxParams1 ctxParams1 := omit) := { initiateAuthenticationResponseEsipa := { initiateAuthenticationOkEsipa := { - transactionId := omit, - serverSigned1 := ts_serverSigned1(euiccChallenge := euiccChallenge, serverAddress := serverAddress), - serverSignature1 := '5252525252525252525252525252525252525252525252525252525252525252 - 5353535353535353535353535353535353535353535353535353535353535353'O, - euiccCiPKIdentifierToBeUsed := 'F54172BDF98A95D65CBEB88A38A1C11D800A85C3'O, /* NIST */ - serverCertificate := ts_cert_s_sm_dpauth_nist, -// serverCertificate := ts_cert_s_sm_dpauth_brp, -// serverCertificate := ts_cert_s_sm_dp2auth_nist, -// serverCertificate := ts_cert_s_sm_dp2auth_brp, - matchingId := omit, - ctxParams1 := omit + transactionId := transactionId, + serverSigned1 := serverSigned1, + serverSignature1 := serverSignature1, + euiccCiPKIdentifierToBeUsed := euiccCiPKIdentifierToBeUsed, + serverCertificate := serverCertificate, + matchingId := matchingId, + ctxParams1 := ctxParams1 } } } @@ -164,6 +170,26 @@ euiccInfo2 := euiccInfo2, ctxParams1 := ctxParams1 } +template (present) SGP32_AuthenticateServerResponse +tr_SGP32_authenticateServerResponse := { + authenticateResponseOk := { + euiccSigned1 := tr_euiccSigned1, + euiccSignature1 := ?, + euiccCertificate := ?, + eumCertificate := ? + } +} +template (value) SGP32_AuthenticateServerResponse +ts_SGP32_authenticateServerResponse := { + authenticateResponseOk := { + euiccSigned1 := ts_euiccSigned1, + euiccSignature1 := '5252525252525252525252525252525252525252525252525252525252525252 + 5353535353535353535353535353535353535353535353535353535353535353'O, + euiccCertificate := ts_cert_euicc_nist, + eumCertificate := ts_cert_eum_nist + } +} +//TODO: Add coresponding parameters template (present) EsipaMessageFromIpaToEim tr_authenticateClientRequestEsipa := { authenticateClientRequestEsipa := { @@ -174,18 +200,11 @@ } } template (value) EsipaMessageFromIpaToEim -ts_authenticateClientRequestEsipa(template (value) octetstring transactionId := 'ABCDEF'O) := { +ts_authenticateClientRequestEsipa(template (value) octetstring transactionId := 'ABCDEF'O, + template (value) SGP32_AuthenticateServerResponse authenticateServerResponse := ts_SGP32_authenticateServerResponse) := { authenticateClientRequestEsipa := { transactionId := transactionId, - authenticateServerResponse := { - authenticateResponseOk := { - euiccSigned1 := ts_euiccSigned1, - euiccSignature1 := '5252525252525252525252525252525252525252525252525252525252525252 - 5353535353535353535353535353535353535353535353535353535353535353'O, - euiccCertificate := ts_cert_euicc_nist, - eumCertificate := ts_cert_eum_nist - } - } + authenticateServerResponse := authenticateServerResponse } }
@@ -223,40 +242,39 @@
/* GSMA SGP.32, section 6.3.2.2 */ template (present) EsipaMessageFromEimToIpa -tr_authenticateClientResponseEsipa_dpe(template (present) octetstring transactionId := ?) := { +tr_authenticateClientResponseEsipa_dpe(template octetstring transactionId := *, + template SGP32_StoreMetadataRequest profileMetaData := *, + template (present) SmdpSigned2 smdpSigned2 := tr_smdpSigned2, + template (present) octetstring smdpSignature2 := ?, + template (present) Certificate smdpCertificate := ?, + template octetstring hashCc := *) := { authenticateClientResponseEsipa := { authenticateClientOkDPEsipa := { transactionId := transactionId, - profileMetaData := *, - smdpSigned2 := { - transactionId := ?, - ccRequiredFlag := ?, - bppEuiccOtpk := * - }, - smdpSignature2 := ?, - smdpCertificate := ?, - hashCc := * + profileMetaData := profileMetaData, + smdpSigned2 := smdpSigned2, + smdpSignature2 := smdpSignature2, + smdpCertificate := smdpCertificate, + hashCc := hashCc } } } template (value) EsipaMessageFromEimToIpa -ts_authenticateClientResponseEsipa_dpe(template (value) octetstring transactionId := 'ABCDEF'O) := { +ts_authenticateClientResponseEsipa_dpe(template (omit) octetstring transactionId := omit, + template (omit) SGP32_StoreMetadataRequest profileMetaData := omit, + template (value) SmdpSigned2 smdpSigned2 := ts_smdpSigned2, + template (value) octetstring smdpSignature2 := '5252525252525252525252525252525252525252525252525252525252525252 + 5353535353535353535353535353535353535353535353535353535353535353'O, + template (value) Certificate smdpCertificate := ts_cert_s_sm_dpauth_nist, + template (omit) octetstring hashCc := omit) := { authenticateClientResponseEsipa := { authenticateClientOkDPEsipa := { transactionId := transactionId, - profileMetaData := omit, - smdpSigned2 := { - transactionId := transactionId, - ccRequiredFlag := false, - bppEuiccOtpk := omit - }, - smdpSignature2 := '5252525252525252525252525252525252525252525252525252525252525252 - 5353535353535353535353535353535353535353535353535353535353535353'O, - smdpCertificate := ts_cert_s_sm_dpauth_nist, -// smdpCertificate := ts_cert_s_sm_dpauth_brp, -// smdpCertificate := ts_cert_s_sm_dp2auth_nist, -// smdpCertificate := ts_cert_s_sm_dp2auth_brp, - hashCc := omit + profileMetaData := profileMetaData, + smdpSigned2 := smdpSigned2, + smdpSignature2 := smdpSignature2, + smdpCertificate := smdpCertificate, + hashCc := hashCc } } } @@ -274,62 +292,71 @@ template (value) EsipaMessageFromIpaToEim ts_getEimPackageRequest(template (value) octetstring eidValue, template (omit) AsnNull notifyStateChange := omit, - template (omit) integer stateChangeCause := omit) := { + template (omit) integer stateChangeCause := omit, + template (omit) octetstring rPLMN := omit) := { getEimPackageRequest := { eidValue := eidValue, notifyStateChange := notifyStateChange, stateChangeCause := stateChangeCause, - rPLMN := omit + rPLMN := rPLMN } }
/* GSMA SGP.32, section 6.3.2.6 and 2.11.1.3 */ +template (present) ProfileDownloadTriggerRequest +tr_profileDownloadTriggerRequest(template (present) charstring activationCode := ?) := { + profileDownloadData := { + activationCode := activationCode + }, + eimTransactionId := * +} +template (value) ProfileDownloadTriggerRequest +ts_profileDownloadTriggerRequest(template (value) charstring activationCode := "1$SMDP.EXAMPLE.COM$$1.3.6.1.4.1.31746") := { + profileDownloadData := { + activationCode := activationCode + }, + eimTransactionId := omit +} template (present) EsipaMessageFromEimToIpa -tr_getEimPackageResponse_dnlTrigReq(template (present) charstring activationCode := ?) := { +tr_getEimPackageResponse_dnlTrigReq(template (present) ProfileDownloadTriggerRequest profileDownloadTriggerRequest := tr_profileDownloadTriggerRequest) := { getEimPackageResponse := { - profileDownloadTriggerRequest := { - profileDownloadData := { - activationCode := activationCode - }, - eimTransactionId := * - } + profileDownloadTriggerRequest := profileDownloadTriggerRequest } } template (value) EsipaMessageFromEimToIpa -ts_getEimPackageResponse_dnlTrigReq(template (value) charstring activationCode := "1$SMDP.EXAMPLE.COM$$1.3.6.1.4.1.31746") := { +ts_getEimPackageResponse_dnlTrigReq(template (value) ProfileDownloadTriggerRequest profileDownloadTriggerRequest := ts_profileDownloadTriggerRequest) := { getEimPackageResponse := { - profileDownloadTriggerRequest := { - profileDownloadData := { - activationCode := activationCode - }, - eimTransactionId := omit - } + profileDownloadTriggerRequest := profileDownloadTriggerRequest } }
/* GSMA SGP.32, section 6.3.2.6 and 2.11.1.2 */ +template (present) IpaEuiccDataRequest +tr_ipaEuiccDataRequest := { + tagList := ?, + euiccCiPKIdentifierToBeUsed := *, + searchCriteriaNotification := *, + searchCriteriaEuiccPackageResult := *, + eimTransactionId := * +} +template (value) IpaEuiccDataRequest +ts_ipaEuiccDataRequest := { + tagList := '81BF20BF228384A5A6A8A9A0'O, + euiccCiPKIdentifierToBeUsed := omit, + searchCriteriaNotification := omit, + searchCriteriaEuiccPackageResult := omit, + eimTransactionId := omit +} template (present) EsipaMessageFromEimToIpa -tr_getEimPackageResponse_euiccDataReq := { +tr_getEimPackageResponse_euiccDataReq(template (present) IpaEuiccDataRequest ipaEuiccDataRequest := tr_ipaEuiccDataRequest) := { getEimPackageResponse := { - ipaEuiccDataRequest := { - tagList := ?, - euiccCiPKIdentifierToBeUsed := *, - searchCriteriaNotification := *, - searchCriteriaEuiccPackageResult := *, - eimTransactionId := * - } + ipaEuiccDataRequest := ipaEuiccDataRequest } } template (value) EsipaMessageFromEimToIpa -ts_getEimPackageResponse_euiccDataReq := { +ts_getEimPackageResponse_euiccDataReq(template (value) IpaEuiccDataRequest ipaEuiccDataRequest := ts_ipaEuiccDataRequest) := { getEimPackageResponse := { - ipaEuiccDataRequest := { - tagList := '81BF20BF228384A5A6A8A9A0'O, - euiccCiPKIdentifierToBeUsed := omit, - searchCriteriaNotification := omit, - searchCriteriaEuiccPackageResult := omit, - eimTransactionId := omit - } + ipaEuiccDataRequest := ipaEuiccDataRequest } }
@@ -629,55 +656,65 @@ }
/* GSMA SGP.32, section 6.3.2.6 */ +template (present) EuiccPackageRequest +tr_euiccPackageRequest(template (present) EuiccPackage euiccPackage := tr_euiccPackage_enablePsmo) := { + euiccPackageSigned := { + eimId := ?, + eidValue := ?, + counterValue := ?, + eimTransactionId := *, + euiccPackage := euiccPackage + }, + eimSignature := ? +} +template (value) EuiccPackageRequest +ts_euiccPackageRequest(template (value) EuiccPackage euiccPackage := ts_euiccPackage_enablePsmo) := { + euiccPackageSigned := { + eimId := "myEim", + eidValue := '00112233445566778899AABBCCDDEEFF'O, + counterValue := 123, + eimTransactionId := omit, + euiccPackage := euiccPackage + }, + eimSignature := '5252525252525252525252525252525252525252525252525252525252525252 + 5353535353535353535353535353535353535353535353535353535353535353'O +} template (present) EsipaMessageFromEimToIpa -tr_getEimPackageResponse_euiccPkgReq(template (present) EuiccPackage euiccPackage := tr_euiccPackage_enablePsmo) := { +tr_getEimPackageResponse_euiccPkgReq(template (present) EuiccPackageRequest euiccPackageRequest := tr_euiccPackageRequest) := { getEimPackageResponse := { - euiccPackageRequest := { - euiccPackageSigned := { - eimId := ?, - eidValue := ?, - counterValue := ?, - eimTransactionId := *, - euiccPackage := euiccPackage - }, - eimSignature := ? - } + euiccPackageRequest := euiccPackageRequest } } template (value) EsipaMessageFromEimToIpa -ts_getEimPackageResponse_euiccPkgReq(template (value) EuiccPackage euiccPackage := ts_euiccPackage_enablePsmo) := { +ts_getEimPackageResponse_euiccPkgReq(template (value) EuiccPackageRequest euiccPackageRequest := ts_euiccPackageRequest) := { getEimPackageResponse := { - euiccPackageRequest := { - euiccPackageSigned := { - eimId := "myEim", - eidValue := '00112233445566778899AABBCCDDEEFF'O, - counterValue := 123, - eimTransactionId := omit, - euiccPackage := euiccPackage - }, - eimSignature := '5252525252525252525252525252525252525252525252525252525252525252 - 5353535353535353535353535353535353535353535353535353535353535353'O - } + euiccPackageRequest := euiccPackageRequest } }
/* GSMA SGP.32, section 6.3.2.5 */ +template (present) SGP32_CancelSessionResponse +tr_SGP32_cancelSessionResponse := { + cancelSessionResponseOk := tr_cancelSessionResponseOk +} +template (value) SGP32_CancelSessionResponse +ts_SGP32_cancelSessionResponse := { + cancelSessionResponseOk := ts_cancelSessionResponseOk +} template (present) EsipaMessageFromIpaToEim -tr_cancelSessionRequestEsipa := { +tr_cancelSessionRequestEsipa(template (present) octetstring transactionId := ?, + template (present) SGP32_CancelSessionResponse cancelSessionResponse := tr_SGP32_cancelSessionResponse) := { cancelSessionRequestEsipa := { - transactionId := ?, - cancelSessionResponse := { - cancelSessionResponseOk := tr_cancelSessionResponseOk - } + transactionId := transactionId, + cancelSessionResponse := cancelSessionResponse } } template (value) EsipaMessageFromIpaToEim -ts_cancelSessionRequestEsipa := { +ts_cancelSessionRequestEsipa(template (value) octetstring transactionId := 'ABCDEF'O, + template (value) SGP32_CancelSessionResponse cancelSessionResponse := ts_SGP32_cancelSessionResponse) := { cancelSessionRequestEsipa := { - transactionId := 'AABBCC'O, - cancelSessionResponse := { - cancelSessionResponseOk := ts_cancelSessionResponseOk - } + transactionId := transactionId, + cancelSessionResponse := cancelSessionResponse } }
@@ -700,40 +737,48 @@ }
/* GSMA SGP.32, section 6.3.2.3 */ +template (present) SGP32_PrepareDownloadResponse +tr_SGP32_prepareDownloadResponse := { + downloadResponseOk := tr_prepareDownloadResponseOk +} +template (value) SGP32_PrepareDownloadResponse +ts_SGP32_prepareDownloadResponse := { + downloadResponseOk := ts_prepareDownloadResponseOk +} template (present) EsipaMessageFromIpaToEim -tr_getBoundProfilePackageRequestEsipa := { +tr_getBoundProfilePackageRequestEsipa(template (present) octetstring transactionId := 'ABCDEF'O, + template (present) SGP32_PrepareDownloadResponse prepareDownloadResponse := tr_SGP32_prepareDownloadResponse) := { getBoundProfilePackageRequestEsipa := { transactionId := ?, - prepareDownloadResponse := { - downloadResponseOk := tr_prepareDownloadResponseOk - } + prepareDownloadResponse := prepareDownloadResponse } } template (value) EsipaMessageFromIpaToEim -ts_getBoundProfilePackageRequestEsipa := { +ts_getBoundProfilePackageRequestEsipa(template (value) octetstring transactionId := 'ABCDEF'O, + template (value) SGP32_PrepareDownloadResponse prepareDownloadResponse := ts_SGP32_prepareDownloadResponse) := { getBoundProfilePackageRequestEsipa := { transactionId := 'ABCDEF'O, - prepareDownloadResponse := { - downloadResponseOk := ts_prepareDownloadResponseOk - } + prepareDownloadResponse := prepareDownloadResponse } }
/* GSMA SGP.32, section 6.3.2.3 */ template (present) EsipaMessageFromEimToIpa -tr_getBoundProfilePackageResponseEsipa := { +tr_getBoundProfilePackageResponseEsipa(template octetstring transactionId := *, + template (present) BoundProfilePackage boundProfilePackage := ?) := { getBoundProfilePackageResponseEsipa := { getBoundProfilePackageOkEsipa := { - transactionId := *, + transactionId := transactionId, boundProfilePackage := tr_boundProfilePackage } } } template (value) EsipaMessageFromEimToIpa -ts_getBoundProfilePackageResponseEsipa := { +ts_getBoundProfilePackageResponseEsipa(template (omit) octetstring transactionId := omit, + template (value) BoundProfilePackage boundProfilePackage := ts_boundProfilePackage) := { getBoundProfilePackageResponseEsipa := { getBoundProfilePackageOkEsipa := { - transactionId := omit, + transactionId := transactionId, boundProfilePackage := ts_boundProfilePackage } } @@ -773,27 +818,53 @@ }
/* GSMA SGP.32, section 6.3.2.4 */ +template (present) SGP32_PendingNotification tr_SGP32_pendingNotification_prfleInstRslt := { + profileInstallationResult := { + profileInstallationResultData := tr_profileInstallationResultData, + euiccSignPIR := ? + } +} +template (value) SGP32_PendingNotification ts_SGP32_pendingNotification_prfleInstRslt(template (value) charstring notificationAddress := "smdp.example.com") := { + profileInstallationResult := { + profileInstallationResultData := ts_profileInstallationResultData(notificationAddress), + euiccSignPIR := '5252525252525252525252525252525252525252525252525252525252525252 + 5353535353535353535353535353535353535353535353535353535353535353'O + } +} template (present) EsipaMessageFromIpaToEim -tr_handleNotificationEsipa_prfleInstRslt(template (present) charstring notificationAddress := ?) := { +tr_handleNotificationEsipa_pendingNotif(template (present) SGP32_PendingNotification pendingNotification := tr_SGP32_pendingNotification_prfleInstRslt) := { handleNotificationEsipa := { - pendingNotification := { - profileInstallationResult := { - profileInstallationResultData := tr_profileInstallationResultData, - euiccSignPIR := ? - } - } + pendingNotification := pendingNotification } } template (value) EsipaMessageFromIpaToEim -ts_handleNotificationEsipa_prfleInstRslt(template (value) charstring notificationAddress := "smdp.example.com") := { +ts_handleNotificationEsipa_pendingNotif(template (value) SGP32_PendingNotification pendingNotification := ts_SGP32_pendingNotification_prfleInstRslt) := { handleNotificationEsipa := { - pendingNotification := { - profileInstallationResult := { - profileInstallationResultData := ts_profileInstallationResultData(notificationAddress), - euiccSignPIR := '5252525252525252525252525252525252525252525252525252525252525252 - 5353535353535353535353535353535353535353535353535353535353535353'O - } - } + pendingNotification := pendingNotification + } +} +template (present) ProvideEimPackageResult +tr_handleNotif_provideEimPackageResult(template octetstring eidValue := *, + template (present) EimPackageResult eimPackageResult := tr_eimPackageResult_ePRAndNotif) := { + eidValue := eidValue, + eimPackageResult := eimPackageResult +} +template (value) ProvideEimPackageResult +ts_handleNotif_provideEimPackageResult(template (omit) octetstring eidValue := omit, + template (value) EimPackageResult eimPackageResult := ts_eimPackageResult_ePRAndNotif) := { + eidValue := eidValue, + eimPackageResult := eimPackageResult +} +template (present) EsipaMessageFromIpaToEim +tr_handleNotificationEsipa_prvdeEimPkgRslt(template (present) ProvideEimPackageResult provideEimPackageResult := tr_handleNotif_provideEimPackageResult) := { + handleNotificationEsipa := { + provideEimPackageResult := provideEimPackageResult + } +} +template (value) EsipaMessageFromIpaToEim +ts_handleNotificationEsipa_prvdeEimPkgRslt(template (value) ProvideEimPackageResult provideEimPackageResult := ts_handleNotif_provideEimPackageResult) := { + handleNotificationEsipa := { + provideEimPackageResult := provideEimPackageResult } }
@@ -1377,110 +1448,90 @@ } }
+template (present) EimPackageResult +tr_eimPackageResult_ePRAndNotif(template (present) EuiccPackageResult euiccPackageResult := tr_euiccPackageResultSigned_enablePsmo) := { + ePRAndNotifications := { + euiccPackageResult := euiccPackageResult, + notificationList := ? + } +} +template (value) EimPackageResult +ts_eimPackageResult_ePRAndNotif(template (value) EuiccPackageResult euiccPackageResult := ts_euiccPackageResultSigned_enablePsmo) := { + ePRAndNotifications := { + euiccPackageResult := euiccPackageResult, + notificationList := { } + } +} +template (present) EimPackageResult +tr_eimPackageResult_euiccDataResp := { + ipaEuiccDataResponse := { + ipaEuiccData := { + notificationsList := *, + defaultSmdpAddress := *, + euiccPackageResultList := *, + euiccInfo1 := *, + euiccInfo2 := *, + rootSmdsAddress := *, + associationToken := *, + eumCertificate := *, + euiccCertificate := *, + eimTransactionId := *, + ipaCapabilities := *, + deviceInfo := * + } + } +} +template (value) EimPackageResult +ts_eimPackageResult_euiccDataResp(template (omit) octetstring eimTransactionId := omit) := { + ipaEuiccDataResponse := { + ipaEuiccData := { + notificationsList := omit, + defaultSmdpAddress := "smdp.example.com", + euiccPackageResultList := omit, + euiccInfo1 := ts_EUICCInfo1, + euiccInfo2 := ts_SGP32_EUICCInfo2, + rootSmdsAddress := "smds.example.com", + associationToken := 1, + eumCertificate := ts_cert_eum_nist, + euiccCertificate := ts_cert_euicc_nist, + eimTransactionId := eimTransactionId, + ipaCapabilities := omit, + deviceInfo := omit + } + } +} +template (present) EimPackageResult +tr_eimPackageResult_euiccDataResp_err := { + ipaEuiccDataResponse := { + ipaEuiccDataResponseError := { + eimTransactionId := *, + ipaEuiccDataErrorCode := ? + } + } +} +template (value) EimPackageResult +ts_eimPackageResult_euiccDataResp_err(template (omit) octetstring eimTransactionId := omit) := { + ipaEuiccDataResponse := { + ipaEuiccDataResponseError := { + eimTransactionId := eimTransactionId, + ipaEuiccDataErrorCode := 127 + } + } +} template (present) EsipaMessageFromIpaToEim -tr_provideEimPackageResult_ePRAndNotif(template octetstring eidValue := *, - template (present) EuiccPackageResult euiccPackageResult := tr_euiccPackageResultSigned_enablePsmo) := { +tr_provideEimPackageResult(template octetstring eidValue := *, + template (present) EimPackageResult eimPackageResult := ?) := { provideEimPackageResult := { eidValue := eidValue, - eimPackageResult := { - ePRAndNotifications := { - euiccPackageResult := euiccPackageResult, - notificationList := ? - } - } + eimPackageResult := eimPackageResult } } template (value) EsipaMessageFromIpaToEim -ts_provideEimPackageResult_ePRAndNotif(template (omit) octetstring eidValue := omit, - template (value) EuiccPackageResult euiccPackageResult := ts_euiccPackageResultSigned_enablePsmo) := { +ts_provideEimPackageResult(template (omit) octetstring eidValue := omit, + template (value) EimPackageResult eimPackageResult := ts_eimPackageResult_ePRAndNotif) := { provideEimPackageResult := { eidValue := eidValue, - eimPackageResult := { - ePRAndNotifications := { - euiccPackageResult := euiccPackageResult, - notificationList := { } - } - } - } -} - -template (present) EsipaMessageFromIpaToEim -tr_provideEimPackageResult_euiccDataResp(template octetstring eidValue := *) := { - provideEimPackageResult := { - eidValue := eidValue, - eimPackageResult := { - ipaEuiccDataResponse := { - ipaEuiccData := { - notificationsList := *, - defaultSmdpAddress := *, - euiccPackageResultList := *, - euiccInfo1 := *, - euiccInfo2 := *, - rootSmdsAddress := *, - associationToken := *, - eumCertificate := *, - euiccCertificate := *, - eimTransactionId := *, - ipaCapabilities := *, - deviceInfo := * - } - } - } - } -} -template (value) EsipaMessageFromIpaToEim -ts_provideEimPackageResult_euiccDataResp(template (omit) octetstring eidValue := omit, - template (omit) octetstring eimTransactionId := omit) := { - provideEimPackageResult := { - eidValue := eidValue, - eimPackageResult := { - ipaEuiccDataResponse := { - ipaEuiccData := { - notificationsList := omit, - defaultSmdpAddress := "smdp.example.com", - euiccPackageResultList := omit, - euiccInfo1 := ts_EUICCInfo1, - euiccInfo2 := ts_SGP32_EUICCInfo2, - rootSmdsAddress := "smds.example.com", - associationToken := 1, - eumCertificate := ts_cert_eum_nist, - euiccCertificate := ts_cert_euicc_nist, - eimTransactionId := eimTransactionId, - ipaCapabilities := omit, - deviceInfo := omit - } - } - } - } -} - -template (present) EsipaMessageFromIpaToEim -tr_provideEimPackageResult_euiccDataResp_err(template octetstring eidValue := *) := { - provideEimPackageResult := { - eidValue := eidValue, - eimPackageResult := { - ipaEuiccDataResponse := { - ipaEuiccDataResponseError := { - eimTransactionId := *, - ipaEuiccDataErrorCode := ? - } - } - } - } -} -template (value) EsipaMessageFromIpaToEim -ts_provideEimPackageResult_euiccDataResp_err(template (omit) octetstring eidValue := omit, - template (omit) octetstring eimTransactionId := omit) := { - provideEimPackageResult := { - eidValue := eidValue, - eimPackageResult := { - ipaEuiccDataResponse := { - ipaEuiccDataResponseError := { - eimTransactionId := eimTransactionId, - ipaEuiccDataErrorCode := 127 - } - } - } + eimPackageResult := eimPackageResult } }
diff --git a/library/euicc/SGP32Definitions_Types.ttcn b/library/euicc/SGP32Definitions_Types.ttcn index c344823..0c1152d 100644 --- a/library/euicc/SGP32Definitions_Types.ttcn +++ b/library/euicc/SGP32Definitions_Types.ttcn @@ -48,4 +48,59 @@ external function enc_ProfileRollbackResponse(in ProfileRollbackResponse msg) return octetstring with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
+external function dec_SGP32_CancelSessionResponse(in octetstring stream) return SGP32_CancelSessionResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_CancelSessionResponse(in SGP32_CancelSessionResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_PrepareDownloadResponse(in octetstring stream) return SGP32_PrepareDownloadResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_PrepareDownloadResponse(in SGP32_PrepareDownloadResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_AuthenticateServerResponse(in octetstring stream) return SGP32_AuthenticateServerResponse +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_AuthenticateServerResponse(in SGP32_AuthenticateServerResponse msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_PendingNotification(in octetstring stream) return SGP32_PendingNotification +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_PendingNotification(in SGP32_PendingNotification msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_ProvideEimPackageResult(in octetstring stream) return ProvideEimPackageResult +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_ProvideEimPackageResult(in ProvideEimPackageResult msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_SGP32_StoreMetadataRequest(in octetstring stream) return SGP32_StoreMetadataRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_SGP32_StoreMetadataRequest(in SGP32_StoreMetadataRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_EuiccPackageRequest(in octetstring stream) return EuiccPackageRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_EuiccPackageRequest(in EuiccPackageRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_IpaEuiccDataRequest(in octetstring stream) return IpaEuiccDataRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_IpaEuiccDataRequest(in IpaEuiccDataRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_ProfileDownloadTriggerRequest(in octetstring stream) return ProfileDownloadTriggerRequest +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_ProfileDownloadTriggerRequest(in ProfileDownloadTriggerRequest msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_EimPackageResult(in octetstring stream) return EimPackageResult +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_EimPackageResult(in EimPackageResult msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + +external function dec_EimAcknowledgements(in octetstring stream) return EimAcknowledgements +with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" }; +external function enc_EimAcknowledgements(in EimAcknowledgements msg) return octetstring +with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" }; + } diff --git a/library/euicc/esipa_Types_JSON.ttcn b/library/euicc/esipa_Types_JSON.ttcn new file mode 100644 index 0000000..11fe6c5 --- /dev/null +++ b/library/euicc/esipa_Types_JSON.ttcn @@ -0,0 +1,561 @@ +/* JSON message definitions for ES9+ + * + * Author: Philipp Maier pmaier@sysmocom.de / sysmocom - s.f.m.c. GmbH + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module esipa_Types_JSON { + +import from esx_header_Types_JSON all; + +import from SGP32Definitions all; +import from SGP32Definitions_Types all; +import from SGP32Definitions_Templates all; + +import from RSPDefinitions all; +import from RSPDefinitions_Types all; +import from RSPDefinitions_Templates all; + +import from PKIX1Explicit88 all; +import from PKIX1Explicit88_Templates all; +import from PKIX1Explicit88_Types all; + +import from PKIX1Implicit88 all; +import from PKIX1Implicit88_Templates all; +import from PKIX1Implicit88_Types all; + +/* GSMA SGP.32, section 6.4.1.1 */ +type record JSON_ESipa_InitiateAuthenticationRequest { + JSON_ESx_RequestHeader header, + charstring euiccChallenge, + charstring euiccInfo1 optional, + charstring smdpAddress optional, + charstring eimTransactionId optional +}; +type record JSON_ESipa_InitiateAuthenticationResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId, + charstring serverSigned1, + charstring serverSignature1, + charstring euiccCiPKIdentifierToBeUsed, + charstring serverCertificate, + universal charstring matchingId optional, + charstring ctxParams1 optional +}; + +/* GSMA SGP.32, section 6.4.1.2 */ +type record JSON_ESipa_AuthenticateClientRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring authenticateServerResponse +}; +type record JSON_ESipa_AuthenticateClientResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId optional, + charstring profileMetadata optional, + charstring smdpSigned2, + charstring smdpSignature2, + charstring smdpCertificate, + charstring hashCc optional +}; + +/* GSMA SGP.32, section 6.4.1.3 */ +type record JSON_ESipa_GetBoundProfilePackageRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring prepareDownloadResponse +}; +type record JSON_ESipa_GetBoundProfilePackageResponse { + JSON_ESx_ResponseHeader header, + charstring transactionId optional, + charstring boundProfilePackage +}; + +/* GSMA SGP.32, section 6.4.1.5 */ +type record JSON_ESipa_GetEimPackageRequest { + JSON_ESx_RequestHeader header, + charstring eidValue, + boolean notifyStateChange optional, + integer stateChangeCause optional, + charstring rPlmn optional +}; +type record JSON_ESipa_GetEimPackageResponse_euiccPkgReq { + JSON_ESx_ResponseHeader header, + charstring euiccPackageRequest +}; +type record JSON_ESipa_GetEimPackageResponse_euiccDataReq { + JSON_ESx_ResponseHeader header, + charstring ipaEuiccDataRequest +}; +type record JSON_ESipa_GetEimPackageResponse_dnlTrigReq { + JSON_ESx_ResponseHeader header, + charstring profileDownloadTriggerRequest +}; +type record JSON_ESipa_GetEimPackageResponse_eimPkgErr { + JSON_ESx_ResponseHeader header, + integer eimPackageError +}; +type union JSON_ESipa_GetEimPackageResponse { + JSON_ESipa_GetEimPackageResponse_euiccPkgReq getEimPackageResponse_euiccPkgReq, + JSON_ESipa_GetEimPackageResponse_euiccDataReq getEimPackageResponse_euiccDataReq, + JSON_ESipa_GetEimPackageResponse_dnlTrigReq getEimPackageResponse_dnlTrigReq, + JSON_ESipa_GetEimPackageResponse_eimPkgErr getEimPackageResponse_eimPkgErr +} with { + variant "JSON : as value" +} + +/* GSMA SGP.32, section 6.4.1.6 */ +type record JSON_ESipa_ProvideEimPackageResultRequest { + JSON_ESx_RequestHeader header, + charstring eidValue optional, + charstring eimPackageResult +}; +type record JSON_ESipa_ProvideEimPackageResultResponse { + JSON_ESx_ResponseHeader header, + charstring eimAcknowledgements optional +}; + +/* GSMA SGP.32, section 6.4.1.7 */ +type record JSON_ESipa_HandleNotification_pendingNotif { + JSON_ESx_RequestHeader header, + charstring pendingNotification +}; +type record JSON_ESipa_HandleNotification_prvdeEimPkgRslt { + JSON_ESx_RequestHeader header, + charstring provideEimPackageResult +}; +type union JSON_ESipa_HandleNotification { + JSON_ESipa_HandleNotification_pendingNotif handleNotification_pendingNotif, + JSON_ESipa_HandleNotification_prvdeEimPkgRslt handleNotification_prvdeEimPkgRslt +} with { + variant "JSON : as value" +} + +/* GSMA SGP.32, section 6.4.1.8 */ +type record JSON_ESipa_CancelSessionRequest { + JSON_ESx_RequestHeader header, + charstring transactionId, + charstring cancelSessionResponse +}; + +/* An empty response that is used when the response only consists of a JSON header */ +type record JSON_ESipa_EmptyResponse { + JSON_ESx_ResponseHeader header +}; + +/* Definition for JSON ESipa requests */ +type union JSON_ESipa_EsipaMessageFromIpaToEim { + JSON_ESipa_InitiateAuthenticationRequest initiateAuthenticationRequest, + JSON_ESipa_AuthenticateClientRequest authenticateClientRequest, + JSON_ESipa_GetBoundProfilePackageRequest getBoundProfilePackageRequest, + JSON_ESipa_GetEimPackageRequest getEimPackageRequest, + JSON_ESipa_ProvideEimPackageResultRequest provideEimPackageResultRequest, + JSON_ESipa_HandleNotification handleNotification, + JSON_ESipa_CancelSessionRequest cancelSessionRequest +} with { + variant "JSON : as value" +} + +external function enc_JSON_ESipa_EsipaMessageFromIpaToEim(in JSON_ESipa_EsipaMessageFromIpaToEim msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ESipa_EsipaMessageFromIpaToEim(in octetstring stream) return JSON_ESipa_EsipaMessageFromIpaToEim +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +/* Definition for JSON ESipa responses */ +type union JSON_ESipa_EsipaMessageFromEimToIpa +{ + JSON_ESipa_InitiateAuthenticationResponse initiateAuthenticationResponse, + JSON_ESipa_AuthenticateClientResponse authenticateClientResponse, + JSON_ESipa_GetBoundProfilePackageResponse getBoundProfilePackageResponse, + JSON_ESipa_GetEimPackageResponse getEimPackageResponse, + JSON_ESipa_ProvideEimPackageResultResponse provideEimPackageResultResponse, + JSON_ESipa_EmptyResponse emptyResponse +} with { + variant "JSON : as value" +} + +external function enc_JSON_ESipa_EsipaMessageFromEimToIpa(in JSON_ESipa_EsipaMessageFromEimToIpa msg) return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ESipa_EsipaMessageFromEimToIpa(in octetstring stream) return JSON_ESipa_EsipaMessageFromEimToIpa +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + +/* Converter function to decode a JSON formatted ESipa request to its ASN.1 ESipa record representation */ +function dec_EsipaMessageFromIpaToEim_from_JSON(in charstring json_pdu_enc, out EsipaMessageFromIpaToEim asn1_pdu_dec) { + var JSON_ESipa_EsipaMessageFromIpaToEim json_pdu; + json_pdu := dec_JSON_ESipa_EsipaMessageFromIpaToEim(char2oct(json_pdu_enc)); + + if (ispresent(json_pdu.initiateAuthenticationRequest)) { + var template charstring smdpAddress := omit; + var template EUICCInfo1 euiccInfo1 := omit; + var template octetstring eimTransactionId := omit; + if (ispresent(json_pdu.initiateAuthenticationRequest.smdpAddress)) { + smdpAddress := json_pdu.initiateAuthenticationRequest.smdpAddress; + } + if (ispresent(json_pdu.initiateAuthenticationRequest.euiccInfo1)) { + euiccInfo1 := dec_EUICCInfo1(decode_base64(json_pdu.initiateAuthenticationRequest.euiccInfo1)); + } + if (ispresent(json_pdu.initiateAuthenticationRequest.eimTransactionId)) { + eimTransactionId := str2oct(json_pdu.initiateAuthenticationRequest.eimTransactionId); + } + asn1_pdu_dec := valueof(ts_initiateAuthenticationRequestEsipa( + decode_base64(json_pdu.initiateAuthenticationRequest.euiccChallenge), + smdpAddress, euiccInfo1, eimTransactionId)); + } else if (ispresent(json_pdu.authenticateClientRequest)) { + asn1_pdu_dec := valueof(ts_authenticateClientRequestEsipa( + str2oct(json_pdu.authenticateClientRequest.transactionId), + dec_SGP32_AuthenticateServerResponse(decode_base64(json_pdu.authenticateClientRequest.authenticateServerResponse)))); + } else if (ispresent(json_pdu.getBoundProfilePackageRequest)) { + asn1_pdu_dec := valueof(ts_getBoundProfilePackageRequestEsipa( + str2oct(json_pdu.getBoundProfilePackageRequest.transactionId), + dec_SGP32_PrepareDownloadResponse(decode_base64(json_pdu.getBoundProfilePackageRequest.prepareDownloadResponse)))); + } else if (ispresent(json_pdu.getEimPackageRequest)) { + var template AsnNull notifyStateChange := omit; + var template integer stateChangeCause := omit; + var template octetstring rPlmn := omit; + if (ispresent(json_pdu.getEimPackageRequest.notifyStateChange) and json_pdu.getEimPackageRequest.notifyStateChange == true) { + notifyStateChange := NULL; + } + if (ispresent(json_pdu.getEimPackageRequest.stateChangeCause)) { + stateChangeCause := json_pdu.getEimPackageRequest.stateChangeCause; + } + if (ispresent(json_pdu.getEimPackageRequest.rPlmn)) { + rPlmn := str2oct(json_pdu.getEimPackageRequest.rPlmn); + } + asn1_pdu_dec := valueof(ts_getEimPackageRequest( + str2oct(json_pdu.getEimPackageRequest.eidValue), + notifyStateChange, stateChangeCause, rPlmn)); + } else if (ispresent(json_pdu.provideEimPackageResultRequest)) { + var template octetstring eidValue := omit; + if (ispresent(json_pdu.provideEimPackageResultRequest.eidValue)) { + eidValue := str2oct(json_pdu.provideEimPackageResultRequest.eidValue); + } + asn1_pdu_dec := valueof(ts_provideEimPackageResult(eidValue, + dec_EimPackageResult(decode_base64(json_pdu.provideEimPackageResultRequest.eimPackageResult)))); + } else if (ispresent(json_pdu.handleNotification)) { + if (ispresent(json_pdu.handleNotification.handleNotification_pendingNotif)) { + asn1_pdu_dec := valueof(ts_handleNotificationEsipa_pendingNotif( + dec_SGP32_PendingNotification(decode_base64(json_pdu.handleNotification.handleNotification_pendingNotif.pendingNotification)))); + } else if (ispresent(json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt)) { + asn1_pdu_dec := valueof(ts_handleNotificationEsipa_prvdeEimPkgRslt( + dec_ProvideEimPackageResult(decode_base64(json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt.provideEimPackageResult)))); + } + } else if (ispresent(json_pdu.cancelSessionRequest)) { + asn1_pdu_dec := valueof(ts_cancelSessionRequestEsipa( + str2oct(json_pdu.cancelSessionRequest.transactionId), + dec_SGP32_CancelSessionResponse(decode_base64(json_pdu.cancelSessionRequest.cancelSessionResponse)))); + } else { + setverdict(fail, "decoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +/* Converter function to encode an ASN.1 ESipa request record to its JSON formatted ESipa representation */ +function enc_EsipaMessageFromIpaToEim_to_JSON(in EsipaMessageFromIpaToEim asn1_pdu_dec, out charstring json_pdu_enc) { + var JSON_ESipa_EsipaMessageFromIpaToEim json_pdu; + + var charstring functionRequesterIdentifier := "TTCN3"; + var charstring functionCallIdentifier := "testsuite"; + + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa)) { + json_pdu.initiateAuthenticationRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.initiateAuthenticationRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.initiateAuthenticationRequest.euiccChallenge := encode_base64(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccChallenge); + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.smdpAddress)) { + json_pdu.initiateAuthenticationRequest.smdpAddress := unichar2char(asn1_pdu_dec.initiateAuthenticationRequestEsipa.smdpAddress); + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccInfo1)) { + json_pdu.initiateAuthenticationRequest.euiccInfo1 := encode_base64(enc_EUICCInfo1(asn1_pdu_dec.initiateAuthenticationRequestEsipa.euiccInfo1)); + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationRequestEsipa.eimTransactionId)) { + json_pdu.initiateAuthenticationRequest.eimTransactionId := oct2str(asn1_pdu_dec.initiateAuthenticationRequestEsipa.eimTransactionId); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientRequestEsipa)) { + json_pdu.authenticateClientRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.authenticateClientRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.authenticateClientRequest.transactionId := oct2str(asn1_pdu_dec.authenticateClientRequestEsipa.transactionId); + json_pdu.authenticateClientRequest.authenticateServerResponse := + encode_base64(enc_SGP32_AuthenticateServerResponse(asn1_pdu_dec.authenticateClientRequestEsipa.authenticateServerResponse)) + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getBoundProfilePackageRequestEsipa)) { + json_pdu.getBoundProfilePackageRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.getBoundProfilePackageRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.getBoundProfilePackageRequest.transactionId := oct2str(asn1_pdu_dec.getBoundProfilePackageRequestEsipa.transactionId); + json_pdu.getBoundProfilePackageRequest.prepareDownloadResponse := + encode_base64(enc_SGP32_PrepareDownloadResponse(asn1_pdu_dec.getBoundProfilePackageRequestEsipa.prepareDownloadResponse)); + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getEimPackageRequest)) { + json_pdu.getEimPackageRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.getEimPackageRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.getEimPackageRequest.eidValue := oct2str(asn1_pdu_dec.getEimPackageRequest.eidValue); + if (ispresent(asn1_pdu_dec.getEimPackageRequest.notifyStateChange) and asn1_pdu_dec.getEimPackageRequest.notifyStateChange == NULL) { + json_pdu.getEimPackageRequest.notifyStateChange := true; + } else { + json_pdu.getEimPackageRequest.notifyStateChange := false; + } + if (ispresent(asn1_pdu_dec.getEimPackageRequest.stateChangeCause)) { + json_pdu.getEimPackageRequest.stateChangeCause := asn1_pdu_dec.getEimPackageRequest.stateChangeCause; + } + if (ispresent(asn1_pdu_dec.getEimPackageRequest.rPLMN)) { + json_pdu.getEimPackageRequest.rPlmn := oct2str(asn1_pdu_dec.getEimPackageRequest.rPLMN); + } + } else if (ispresent(asn1_pdu_dec.provideEimPackageResult)) { + json_pdu.provideEimPackageResultRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.provideEimPackageResultRequest.header.functionCallIdentifier := functionCallIdentifier; + if (ispresent(asn1_pdu_dec.provideEimPackageResult.eidValue)) { + json_pdu.provideEimPackageResultRequest.eidValue := oct2str(asn1_pdu_dec.provideEimPackageResult.eidValue); + } + json_pdu.provideEimPackageResultRequest.eimPackageResult := + encode_base64(enc_EimPackageResult(asn1_pdu_dec.provideEimPackageResult.eimPackageResult)); + } else if (ispresent(asn1_pdu_dec.handleNotificationEsipa)) { + json_pdu.handleNotification.handleNotification_pendingNotif.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.handleNotification.handleNotification_pendingNotif.header.functionCallIdentifier := functionCallIdentifier; + if (ispresent(asn1_pdu_dec.handleNotificationEsipa.pendingNotification)) { + json_pdu.handleNotification.handleNotification_pendingNotif.pendingNotification := + encode_base64(enc_SGP32_PendingNotification(asn1_pdu_dec.handleNotificationEsipa.pendingNotification)) + } else if (ispresent(asn1_pdu_dec.handleNotificationEsipa.provideEimPackageResult)) { + json_pdu.handleNotification.handleNotification_prvdeEimPkgRslt.provideEimPackageResult := + encode_base64(enc_ProvideEimPackageResult(asn1_pdu_dec.handleNotificationEsipa.provideEimPackageResult)) + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else if (ispresent(asn1_pdu_dec.cancelSessionRequestEsipa)) { + json_pdu.cancelSessionRequest.header.functionRequesterIdentifier := functionRequesterIdentifier; + json_pdu.cancelSessionRequest.header.functionCallIdentifier := functionCallIdentifier; + json_pdu.cancelSessionRequest.transactionId := oct2str(asn1_pdu_dec.cancelSessionRequestEsipa.transactionId); + json_pdu.cancelSessionRequest.cancelSessionResponse := + encode_base64(enc_SGP32_CancelSessionResponse(asn1_pdu_dec.cancelSessionRequestEsipa.cancelSessionResponse)) + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromIpaToEim(json_pdu)); + } else { + setverdict(fail, "encoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +type record DecodedRPPReponse_Wrap { + EsipaMessageFromEimToIpa asn1_pdu optional, + JSON_ESx_FunctionExecutionStatusCodeData err optional +} + +/* Converter function to decode a JSON formatted ESipa response to its ASN.1 ESipa record representation */ +function dec_EsipaMessageFromEimToIpa_from_JSON(in charstring json_pdu_enc, out DecodedRPPReponse_Wrap wrapped_resp) { + var JSON_ESipa_EsipaMessageFromEimToIpa json_pdu; + json_pdu := dec_JSON_ESipa_EsipaMessageFromEimToIpa(char2oct(json_pdu_enc)); + + if (ispresent(json_pdu.initiateAuthenticationResponse)) { + var template octetstring transactionId := omit; + var template universal charstring matchingId := omit; + var template CtxParams1 ctxParams1 := omit; + if (not match(json_pdu.initiateAuthenticationResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.initiateAuthenticationResponse.transactionId)) { + transactionId := str2oct(json_pdu.initiateAuthenticationResponse.transactionId); + } + if (ispresent(json_pdu.initiateAuthenticationResponse.matchingId)) { + matchingId := json_pdu.initiateAuthenticationResponse.matchingId; + } + if (ispresent(json_pdu.initiateAuthenticationResponse.ctxParams1)) { + ctxParams1 := dec_CtxParams1(decode_base64(json_pdu.initiateAuthenticationResponse.ctxParams1)); + } + wrapped_resp.asn1_pdu := valueof(ts_initiateAuthenticationResponseEsipa( + transactionId, + dec_ServerSigned1(decode_base64(json_pdu.initiateAuthenticationResponse.serverSigned1)), + decode_base64(json_pdu.initiateAuthenticationResponse.serverSignature1), + dec_SubjectKeyIdentifier(decode_base64(json_pdu.initiateAuthenticationResponse.euiccCiPKIdentifierToBeUsed)), + dec_Certificate(decode_base64(json_pdu.initiateAuthenticationResponse.serverCertificate)), + matchingId, + ctxParams1)); + } else if (ispresent(json_pdu.authenticateClientResponse)) { + var template octetstring transactionId := omit; + var template SGP32_StoreMetadataRequest profileMetaData := omit; + var template octetstring hashCc := omit; + if (not match(json_pdu.authenticateClientResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.authenticateClientResponse.transactionId)) { + transactionId := str2oct(json_pdu.authenticateClientResponse.transactionId); + } + if (ispresent(json_pdu.authenticateClientResponse.profileMetadata)) { + profileMetaData := dec_SGP32_StoreMetadataRequest(decode_base64(json_pdu.authenticateClientResponse.profileMetadata)) + } + if (ispresent(json_pdu.authenticateClientResponse.hashCc)) { + hashCc := decode_base64(json_pdu.authenticateClientResponse.hashCc); + } + wrapped_resp.asn1_pdu := valueof(ts_authenticateClientResponseEsipa_dpe(transactionId, profileMetaData, + dec_SmdpSigned2(decode_base64(json_pdu.authenticateClientResponse.smdpSigned2)), + decode_base64(json_pdu.authenticateClientResponse.smdpSignature2), + dec_Certificate(decode_base64(json_pdu.authenticateClientResponse.smdpCertificate)), + hashCc)); + } else if (ispresent(json_pdu.getBoundProfilePackageResponse)) { + var template octetstring transactionId := omit; + if (not match(json_pdu.getBoundProfilePackageResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.getBoundProfilePackageResponse.transactionId)) { + transactionId := str2oct(json_pdu.getBoundProfilePackageResponse.transactionId); + } + wrapped_resp.asn1_pdu := valueof(ts_getBoundProfilePackageResponseEsipa(transactionId, + dec_BoundProfilePackage(decode_base64(json_pdu.getBoundProfilePackageResponse.boundProfilePackage)))); + } else if (ispresent(json_pdu.getEimPackageResponse)) { + if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_euiccPkgReq( + dec_EuiccPackageRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.euiccPackageRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_euiccDataReq( + dec_IpaEuiccDataRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.ipaEuiccDataRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq)) { + + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_dnlTrigReq( + dec_ProfileDownloadTriggerRequest(decode_base64(json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.profileDownloadTriggerRequest)))); + } else if (ispresent(json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr)) { + if (not match(json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + wrapped_resp.asn1_pdu := valueof(ts_getEimPackageResponse_eimPkgErr( + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.eimPackageError)); + } + } else if (ispresent(json_pdu.provideEimPackageResultResponse)) { + /* TODO: Map JSON error to an provideEimPackageResultError of the ASN.1 output, check if similar + * is possible for the other structs? */ + if (not match(json_pdu.provideEimPackageResultResponse.header, ts_responseHeader)) { + setverdict(fail, "unsuccessful request"); + } + if (ispresent(json_pdu.provideEimPackageResultResponse.eimAcknowledgements)) { + wrapped_resp.asn1_pdu := valueof(ts_provideEimPackageResultResponse_eimAck( + dec_EimAcknowledgements(decode_base64(json_pdu.provideEimPackageResultResponse.eimAcknowledgements)))); + } else { + wrapped_resp.asn1_pdu := valueof(ts_provideEimPackageResultResponse_empty) + } + } else if (ispresent(json_pdu.emptyResponse)) { + if (not match(json_pdu.emptyResponse.header, ts_responseHeader)) { + wrapped_resp.err := json_pdu.emptyResponse.header.functionExecutionStatus.statusCodeData; + } else { + /* Success case for empty response - initialize optional fields */ + wrapped_resp.asn1_pdu := omit; + wrapped_resp.err := omit; + } + } else { + setverdict(fail, "decoder path not implemented for JSON ESipa message"); + } +} with { extension "prototype(fast)" } + +/* Converter function to encode an ASN.1 ESipa response record to its JSON formatted ESipa representation */ +function enc_EsipaMessageFromEimToIpa_to_JSON(in EsipaMessageFromEimToIpa asn1_pdu_dec, out charstring json_pdu_enc) { + var JSON_ESipa_EsipaMessageFromEimToIpa json_pdu; + + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa)) { + json_pdu.initiateAuthenticationResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.transactionId)) { + json_pdu.initiateAuthenticationResponse.transactionId := + oct2str(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.transactionId); + } + json_pdu.initiateAuthenticationResponse.serverSigned1 := + encode_base64(enc_ServerSigned1(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverSigned1)); + json_pdu.initiateAuthenticationResponse.serverSignature1 := + encode_base64(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverSignature1); + json_pdu.initiateAuthenticationResponse.euiccCiPKIdentifierToBeUsed := + encode_base64(enc_SubjectKeyIdentifier(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.euiccCiPKIdentifierToBeUsed)); + json_pdu.initiateAuthenticationResponse.serverCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.serverCertificate)); + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.matchingId)) { + json_pdu.initiateAuthenticationResponse.matchingId := + asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.matchingId; + } + if (ispresent(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.ctxParams1)) { + json_pdu.initiateAuthenticationResponse.ctxParams1 := + encode_base64(enc_CtxParams1(asn1_pdu_dec.initiateAuthenticationResponseEsipa.initiateAuthenticationOkEsipa.ctxParams1)); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa)) { + json_pdu.authenticateClientResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.transactionId)) { + json_pdu.authenticateClientResponse.transactionId := + oct2str(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.transactionId); + } + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.profileMetaData)) { + json_pdu.authenticateClientResponse.profileMetadata := + encode_base64(enc_SGP32_StoreMetadataRequest(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.profileMetaData)); + } + json_pdu.authenticateClientResponse.smdpSigned2 := + encode_base64(enc_SmdpSigned2(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpSigned2)); + json_pdu.authenticateClientResponse.smdpSignature2 := + encode_base64(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpSignature2); + json_pdu.authenticateClientResponse.smdpCertificate := + encode_base64(enc_Certificate(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.smdpCertificate)); + if (ispresent(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.hashCc)) { + json_pdu.authenticateClientResponse.hashCc := + encode_base64(asn1_pdu_dec.authenticateClientResponseEsipa.authenticateClientOkDPEsipa.hashCc); + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getBoundProfilePackageResponseEsipa)) { + json_pdu.getBoundProfilePackageResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.transactionId)) { + json_pdu.getBoundProfilePackageResponse.transactionId := + oct2str(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.transactionId); + } + json_pdu.getBoundProfilePackageResponse.boundProfilePackage := + encode_base64(enc_BoundProfilePackage(asn1_pdu_dec.getBoundProfilePackageResponseEsipa.getBoundProfilePackageOkEsipa.boundProfilePackage)); + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse)) { + if (ispresent(asn1_pdu_dec.getEimPackageResponse.euiccPackageRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccPkgReq.euiccPackageRequest := + encode_base64(enc_EuiccPackageRequest(asn1_pdu_dec.getEimPackageResponse.euiccPackageRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.ipaEuiccDataRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_euiccDataReq.ipaEuiccDataRequest := + encode_base64(enc_IpaEuiccDataRequest(asn1_pdu_dec.getEimPackageResponse.ipaEuiccDataRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.profileDownloadTriggerRequest)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_dnlTrigReq.profileDownloadTriggerRequest := + encode_base64(enc_ProfileDownloadTriggerRequest(asn1_pdu_dec.getEimPackageResponse.profileDownloadTriggerRequest)); + } else if (ispresent(asn1_pdu_dec.getEimPackageResponse.eimPackageError)) { + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu.getEimPackageResponse.getEimPackageResponse_eimPkgErr.eimPackageError := + asn1_pdu_dec.getEimPackageResponse.eimPackageError; + } + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else if (ispresent(asn1_pdu_dec.provideEimPackageResultResponse)) { + json_pdu.provideEimPackageResultResponse.header.functionExecutionStatus.status := "Executed-Success"; + if (ispresent(asn1_pdu_dec.provideEimPackageResultResponse.eimAcknowledgements)) { + json_pdu.provideEimPackageResultResponse.eimAcknowledgements := + encode_base64(enc_EimAcknowledgements(asn1_pdu_dec.provideEimPackageResultResponse.eimAcknowledgements)); + } + } else if (ispresent(asn1_pdu_dec.cancelSessionResponseEsipa)) { + /* This message has no JSON body, see also GSMA SGP.32, section 6.4.1.8 */ + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } else { + json_pdu.emptyResponse.header.functionExecutionStatus.status := "Executed-Success"; + json_pdu_enc := oct2char(enc_JSON_ESipa_EsipaMessageFromEimToIpa(json_pdu)); + } +} with { extension "prototype(fast)" } + +} with { + encode "JSON"; +}