-- Section 2.1.3
-- ASN1START
SGP32Definitions {joint-iso-itu-t(2) international-organizations(23) gsma(146) rsp(1) asn1modules(1) sgp32v1(31)}
DEFINITIONS
AUTOMATIC TAGS
EXTENSIBILITY IMPLIED ::=
BEGIN

IMPORTS Certificate, SubjectPublicKeyInfo
FROM PKIX1Explicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-explicit(18)}
SubjectKeyIdentifier FROM PKIX1Implicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit(19)}

ProfileInfo, EuiccSigned1, CancelSessionReason, RetrieveNotificationsListResponse,
ServerSigned1, RspCapability, Iccid, TransactionId, ProfileInfoListRequest,
ProfileInfoListResponse, RulesAuthorisationTable, EUICCInfo1, DeviceInfo,
VersionType, UICCCapability, PprIds,
CertificationDataObject, Octet1, Octet16, Octet32, PrepareDownloadResponse,
PrepareDownloadResponseOk, PrepareDownloadResponseError,
AuthenticateServerResponse, AuthenticateResponseOk, AuthenticateResponseError,
CtxParams1, ProfileInstallationResult, ProfileInstallationResultData,
OtherSignedNotification, EuiccSignPIR, ErrorResult, NotificationMetadata,
CancelSessionResponse, CancelSessionResponseOk,
StoreMetadataRequest, SmdpSigned2, BoundProfilePackage, NotificationEvent
FROM RSPDefinitions {joint-iso-itu-t(2) international-organizations(23) gsma(146) rsp(1) asn1modules(1) sgp22v2(2)};
-- ASN1STOP

-- Section 2.11.1.1
-- ASN1START
EuiccPackageRequest ::= [81] SEQUENCE { -- Tag ' BF51', #SupportedForPsmoV1.0.0#
  euiccPackageSigned EuiccPackageSigned,
  eimSignature [APPLICATION 55] OCTET STRING -- Tag '5F37'
}
EuiccPackageSigned ::= SEQUENCE {
  eimId [0] UTF8String,
  eidValue [APPLICATION 26] Octet16, -- Tag '5A'
  counterValue [1] INTEGER,
  transactionId [2] TransactionId OPTIONAL,
  euiccPackage EuiccPackage
}
EuiccPackage ::= CHOICE {
  psmoList SEQUENCE OF Psmo, -- #SupportedForPsmoV1.0.0#
  ecoList SEQUENCE OF Eco -- #SupportedForEcoV1.0.0#
}
-- ASN1STOP


-- Section 2.11.1.1.1
-- ASN1START
EimConfigurationData ::= SEQUENCE {
  eimId [0] UTF8String, -- eimId of eIM
  eimFqdn [1] UTF8String OPTIONAL, -- FQDN of eIM
  eimIdType [2] EimIdType OPTIONAL,
  counterValue [3] INTEGER OPTIONAL, -- initial counterValue for the eIM
  associationToken [4] INTEGER OPTIONAL,
  eimPublicKeyData [5] CHOICE {
    eimPublicKey SubjectPublicKeyInfo, -- public key of eIM, used for eUICC Package signature verification, where the encoding follows X.509 standard
    eimCertificate Certificate -- certificate of eIM, used for eUICC Package signature verification, where the encoding follows X.509 standard
  } OPTIONAL,
  trustedPublicKeyDataTls [6] CHOICE {
    trustedEimPkTls SubjectPublicKeyInfo, -- public key of eIM, used for TLS or DTLS, where the encoding follows X.509 standard
    trustedCertificateTls Certificate -- either the certificate of eIM, used for (D)TLS, or the certificate of the CA, where the encoding follows X.509 standard
  } OPTIONAL,
  eimSupportedProtocol [7] EimSupportedProtocol OPTIONAL,
  euiccCiPKId [8] SubjectKeyIdentifier OPTIONAL -- CI Public Key Identifier supported on the eUICC for signature creation
}
EimIdType ::= INTEGER {
  eimIdTypeOid(1),
  eimIdTypeFqdn(2),
  eimIdTypeProprietary(3)
}
  EimSupportedProtocol ::= BIT STRING {
  eimRetrieveHttps(0),
  eimRetrieveCoaps(1),
  eimInjectHttps(2),
  eimInjectCoaps(3),
  eimProprietary(4)
}
-- ASN1STOP

-- Section 2.11.1.1.2
-- ASN1START
Eco ::= CHOICE {
  addEim [8] EimConfigurationData, -- for eIM configuration data see 2.11.1
  deleteEim [9] SEQUENCE {eimId [0] UTF8String},
  updateEim [10] EimConfigurationData,
  listEim [11] SEQUENCE {}
}
-- ASN1STOP

-- Section 2.11.1.1.3
-- ASN1START
Psmo ::= CHOICE {
  enable [3] SEQUENCE {
    iccid [APPLICATION 26] Iccid,
    rollbackFlag NULL OPTIONAL
  },
  disable [4] SEQUENCE {iccid [APPLICATION 26] Iccid},
  delete [5] SEQUENCE {iccid [APPLICATION 26] Iccid},
  listProfileInfo [45] ProfileInfoListRequest, -- Tag 'BF2D'
  getRAT [6] SEQUENCE {},
  configureAutoEnable [7] SEQUENCE {
    autoEnableFlag [0] NULL OPTIONAL,
    smdpOid [1] OBJECT IDENTIFIER OPTIONAL,
    smdpAddress [2] UTF8String OPTIONAL
  }
}
-- ASN1STOP


-- Section 2.11.1.2
-- ASN1START
IpaEuiccDataRequest ::= [82] SEQUENCE { -- Tag BF52
  tagList [APPLICATION 28] OCTET STRING, -- Tag '5C'
  euiccCiPKId SubjectKeyIdentifier OPTIONAL, -- CI Public Key Identifier supported on the eUICC for signature creation
  searchCriteria [1] CHOICE {
    seqNumber [0] INTEGER,
    profileManagementOperation [1] NotificationEvent,
    euiccPackageResults [2] NULL
  } OPTIONAL
}
-- ASN1STOP

-- Section 2.11.1.3
-- ASN1START
ProfileDownloadTriggerRequest ::= [84] SEQUENCE { -- Tag 'BF54'
  profileDownloadData [0] ProfileDownloadData OPTIONAL,
  eimTransactionId [2] TransactionId OPTIONAL
}
ProfileDownloadData ::= CHOICE {
  activationCode [0] UTF8String (SIZE(0..255)),
  contactDefaultSmdp [1] NULL,
  contactSmds [2] SEQUENCE {
    smdsAddress UTF8String OPTIONAL
  }
}
-- ASN1STOP

-- Section 2.11.1.4
-- ASN1START
EimAcknowledgements ::= [83] SEQUENCE OF SequenceNumber -- Tag BF53
SequenceNumber ::= [0] INTEGER
-- ASN1STOP


-- Section 2.11.2.1
-- ASN1START
EuiccPackageResult ::= [81] CHOICE { -- Tag 'BF51' #SupportedForPsmoV1.0.0#
  euiccPackageResultSigned EuiccPackageResultSigned,
  euiccPackageErrorSigned EuiccPackageErrorSigned,
  euiccPackageErrorUnsigned EuiccPackageErrorUnsigned
}
EuiccPackageResultSigned ::= SEQUENCE {
  euiccPackageResultDataSigned EuiccPackageResultDataSigned,
  euiccSignEPR [APPLICATION 55] OCTET STRING -- Tag '5F37'
}
EuiccPackageResultDataSigned ::= SEQUENCE { -- #SupportedForPsmoV1.0.0#
  eimId [0] UTF8String,
  counterValue [1] INTEGER,
  transactionId[2] TransactionId OPTIONAL,
  seqNumber [3] INTEGER,
  euiccResult SEQUENCE OF EuiccResultData
}
EuiccResultData ::= CHOICE {
  enableResult [3] EnableProfileResult,
  disableResult [4] DisableProfileResult,
  deleteResult [5] DeleteProfileResult,
  listProfileInfoResult [45] SGP32-ProfileInfoListResponse,
  getRATResult [6] RulesAuthorisationTable, -- see SGP.22
  configureAutoEnableResult [7] ConfigureAutoEnableResult,
  addEimResult [8] AddEimResult,
  deleteEimResult [9] DeleteEimResult,
  updateEimResult [10] UpdateEimResult,
  listEimResult [11] ListEimResult,
  rollbackResult [12] RollbackProfileResult,
  processingTerminated INTEGER {
    resultSizeOverflow(1),
    unknownOrDamagedCommand(2),
    interruption(3),
    undefinedError(127)
  }
}
EuiccPackageErrorSigned ::= SEQUENCE {
  euiccPackageErrorDataSigned EuiccPackageErrorDataSigned,
  euiccSignEPE [APPLICATION 55] OCTET STRING -- Tag '5F37'
}
EuiccPackageErrorDataSigned ::= SEQUENCE {
  eimId [0] UTF8String,
  counterValue [1] INTEGER,
  transactionId [2] TransactionId OPTIONAL,
  euiccPackageErrorCode EuiccPackageErrorCode
}
EuiccPackageErrorCode ::= INTEGER { invalidEid(3), replayError(4), counterValueOutOfRange(6), sizeOverflow(15), undefinedError(127)}
EuiccPackageErrorUnsigned ::= SEQUENCE {
  eimId [0] UTF8String,
  associationToken [4] INTEGER OPTIONAL
}
ConfigureAutoEnableResult ::= INTEGER {
  ok(0),
  insufficientMemory(1),
  commandError(7),
  undefinedError(127)
}
EnableProfileResult ::= INTEGER {
  ok(0),
  iccidOrAidNotFound(1),
  profileNotInDisabledState(2),
  undefinedError(127)
}
DisableProfileResult ::= INTEGER {
  ok(0),
  iccidOrAidNotFound(1),
  profileNotInEnabledState(2),
  undefinedError(127)
}
DeleteProfileResult ::= INTEGER {
  ok(0),
  iccidOrAidNotFound(1),
  profileNotInDisabledState(2),
  undefinedError(127)
}
SGP32-ProfileInfoListResponse ::= [45] CHOICE {
  profileInfoListOk SEQUENCE OF ProfileInfo, -- see SGP.22
  profileInfoListError SGP32-ProfileInfoListError
}
SGP32-ProfileInfoListError ::= INTEGER {
  incorrectInputValues(1),
  profileChangeOngoing (11),
  undefinedError(127)
}
RollbackProfileResult ::= INTEGER {
  ok(0),
  undefinedError(127)
}
AddEimResult ::= CHOICE {
  associationToken [4] INTEGER,
  addEimResultCode INTEGER {
    ok(0),
    insufficientMemory(1),
    ciPKUnknown(3),
    invalidAssociationToken(5),
    counterValueOutOfRange(6),
    commandError(7),
    undefinedError(127)
  }
}
DeleteEimResult ::= INTEGER {
  ok(0),
  eimNotFound(1),
  lastEimDeleted(2), -- no eIM Configuration Data available in eUICC,
  commandError(7),
  undefinedError(127)
}
UpdateEimResult ::= INTEGER {
  ok(0),
  eimNotFound (1),
  ciPKUnknown(3),
  counterValueOutOfRange(6),
  commandError(7),
  undefinedError(127)
}
ListEimResult ::= CHOICE {
  eimIdList SEQUENCE OF EimIdInfo,
  listEimError INTEGER {
    commandError(7),
    undefinedError(127)
  }
}
EimIdInfo ::= SEQUENCE {
  eimId [0] UTF8String,
  eimIdType [4] EimIdType  OPTIONAL -- present in case of eimIdTypeOid and eimIdTypeFqdn
}
-- ASN1STOP

-- Section 2.11.2.2
-- ASN1START
IpaEuiccDataResponse ::= [82] CHOICE { -- Tag 'BF52'
  ipaEuiccData IpaEuiccData,
  ipaEuiccDataError INTEGER {
    incorrectTagList (1),
    euiccCiPKIdNotFound(5),
    undefinedError(127)
  }
}
IpaEuiccData ::= SEQUENCE {
  defaultSmdpAddress [0] UTF8String OPTIONAL, -- Tag '80'
  euiccInfo1 [32] EUICCInfo1 OPTIONAL, -- Tag 'BF20'
  euiccInfo2 [34] SGP32-EUICCInfo2 OPTIONAL, -- Tag 'BF22'
  rootSmdsAddress [3] UTF8String OPTIONAL, -- Tag '83'
  associationToken [4] INTEGER OPTIONAL, -- Tag '84'
  eumCertificate [5] Certificate OPTIONAL, -- Tag 'A5'
  euiccCertificate [6] Certificate OPTIONAL, -- Tag 'A6'
  ipaCapabilities [8] IpaCapabilities OPTIONAL, -- Tag '88'
  deviceInfo [9] DeviceInfo OPTIONAL, -- Tag 'A9'
  notificationsList [43] SGP32-RetrieveNotificationsListResponse OPTIONAL -- Tag 'BF2B'.
}
-- ASN1STOP

-- Section 2.11.2.3
-- ASN1START
ProfileDownloadTriggerResult ::= [84] SEQUENCE { -- tag 'BF54'
  eimTransactionId [2] TransactionId OPTIONAL,
  profileDownloadTriggerResultData CHOICE {
    profileInstallationResult [55] SGP32-ProfileInstallationResult, -- see SGP.22 [4]
    profileDownloadError SEQUENCE {
      errorResponse OCTET STRING OPTIONAL
    }
  }
}
-- ASN1STOP

-- Section 4.1
-- ASN1START
IpaCapabilities ::= SEQUENCE {
  ipaFeatures [0] BIT STRING {
    directRspServerCommunication (0),
    indirectRspServerCommunication (1),
    eimDownloadDataHandling (2),
    eimCtxParams1Generation (3),
    eimProfileMetadataVerification (4),
    minimizeEsipaBytes (5)
  },
  ipaSupportedProtocols [1] BIT STRING {
    ipaRetrieveHttps(0),
    ipaRetrieveCoaps(1),
    ipaInjectHttps(2),
    ipaInjectCoaps(3),
    ipaProprietary(4)
  } OPTIONAL
}
-- ASN1STOP

-- Section 5.9.2
-- ASN1START
SGP32-EUICCInfo2 ::= [34] SEQUENCE { -- Tag 'BF22'
  profileVersion [1] VersionType, -- Base eUICC Profile package version supported
  svn [2] VersionType, -- GSMA SGP.22 version supported (SVN)referenced by SGP.32
  euiccFirmwareVer [3] VersionType, -- eUICC Firmware version
  extCardResource [4] OCTET STRING, -- Extended Card Resource Information according to ETSI TS 102 226
  uiccCapability [5] UICCCapability,
  ts102241Version [6] VersionType OPTIONAL,
  globalplatformVersion [7] VersionType OPTIONAL,
  rspCapability [8] RspCapability,
  euiccCiPKIdListForVerification [9] SEQUENCE OF SubjectKeyIdentifier, -- List of CI Public Key Identifiers supported on the eUICC for signature verification
  euiccCiPKIdListForSigning [10] SEQUENCE OF SubjectKeyIdentifier, -- List of CI Public Key Identifier supported on the eUICC for signature creation
  euiccCategory [11] INTEGER {
    other(0),
    basicEuicc(1),
    mediumEuicc(2),
    contactlessEuicc(3)
  } OPTIONAL,
  forbiddenProfilePolicyRules [25] PprIds OPTIONAL, -- Tag '99'
  ppVersion VersionType, -- Protection Profile version
  sasAcreditationNumber UTF8String (SIZE(0..64)),
  certificationDataObject [12] CertificationDataObject OPTIONAL,
  treProperties [13] BIT STRING {
    isDiscrete(0),
    isIntegrated(1),
    usesRemoteMemory(2) -- refers to the usage of remote memory protected by the Remote Memory Protection Function described in SGP.21 [4]
  } OPTIONAL,
  treProductReference [14] UTF8String OPTIONAL, -- Platform_Label as defined in GlobalPlatform DLOA specification [57]
  additionalEuiccProfilePackageVersions [15] SEQUENCE OF VersionType OPTIONAL,
  ipaMode [16] IpaMode OPTIONAL, -- active IPA, mandatory within SGP.32
  rfu2 [17] SEQUENCE OF SubjectKeyIdentifier OPTIONAL, -- not used by this version of SGP.32.
  rfu3 [18] OCTET STRING (SIZE(0..32)) OPTIONAL,
  -- not used by this version of SGP.32
  rfu4 [19] VersionType OPTIONAL, -- not used by this version of SGP.32
  iotSpecificInfo [20] IoTSpecificInfo OPTIONAL -- mandatory within SGP.32
}
-- Definition of IoTSpecificInfo
IoTSpecificInfo ::= SEQUENCE {
iotVersion [0] SEQUENCE OF VersionType -- SGP.32 version(s) supported by the eUICC, at least one must be present
}
-- Definition of IpaMode
IpaMode ::= INTEGER {
ipad (0), -- IPAd is active
ipae (1) -- IPAe is active
}
-- ASN1STOP

-- Section 5.9.4
-- ASN1START
AddInitialEimRequest ::= [87] SEQUENCE { -- Tag 'BF57'
  eimConfigurationDataList [0] SEQUENCE OF EimConfigurationData
}
-- ASN1STOP

-- Section 5.9.4
-- ASN1START
AddInitialEimResponse ::= [87] CHOICE { -- Tag 'BF57'
  addInitialEimOk SEQUENCE OF CHOICE {
    associationToken [4] INTEGER,
    addOk NULL
  },
  addInitialEimError INTEGER {
    insufficientMemory(1),
    unsignedEimConfigDisallowed(2),
    ciPKUnknown(3),
    invalidAssociationToken(5),
    counterValueOutOfRange(6),
    undefinedError(127)
  }
}
-- ASN1STOP


-- Section 5.9.10
-- ASN1START
GetCertsRequest ::= [86] SEQUENCE { -- Tag 'BF56'
  euiccCiPKId SubjectKeyIdentifier OPTIONAL -- CI Public Key Identifier supported on the eUICC for signature creation
}
-- ASN1STOP
-- ASN1START
GetCertsResponse ::= [86] CHOICE { -- Tag 'BF56'
  certs SEQUENCE {
    eumCertificate [5] Certificate, -- Tag 'A5'
    euiccCertificate [6] Certificate -- Tag 'A6'
  },
  getCertsError INTEGER {invalidCiPKId(1), undfinedError(127)}
}
-- ASN1STOP

-- Section 5.9.11 (no ASN1START/STOP)!
SGP32-RetrieveNotificationsListRequest ::= [43] SEQUENCE { -- Tag 'BF2B'
  searchCriteria CHOICE {
    seqNumber [0] INTEGER,
    profileManagementOperation [1] NotificationEvent,
    euiccPackageResults [2] NULL
  } OPTIONAL
}

-- ASN1START
SGP32-RetrieveNotificationsListResponse ::= [43] CHOICE { -- Tag 'BF2B'
  notificationList SEQUENCE OF SGP32-PendingNotification,
  notificationsListResultError INTEGER { undefinedError(127)},
  euiccPackageResultList SEQUENCE OF EuiccPackageResult,
  notificationAndEprList SEQUENCE {
    notificationList SEQUENCE OF SGP32-PendingNotification,
    euiccPackageResultList SEQUENCE OF EuiccPackageResult
  }
}
-- ASN1STOP

-- Section 5.9.15
-- ASN1START
EnableUsingDDRequest ::= [90] SEQUENCE { -- Tag 'BF5A'
}
-- ASN1STOP
-- ASN1START
EnableUsingDDResponse ::= [90] SEQUENCE { -- Tag 'BF5A'
  enableUsingDDResult [0] INTEGER {
    ok(0),
    autoEnableNotAvailable(1),
    noSessionContext(4),
    undefinedError(127)
  }
}
-- ASN1STOP

-- Section 5.9.16
-- ASN1START
ProfileRollbackRequest ::= [88] SEQUENCE { -- Tag 'BF58'
  refreshFlag BOOLEAN -- indicating whether REFRESH is required
}
-- ASN1STOP
-- ASN1START
ProfileRollbackResponse ::= [88] SEQUENCE { -- Tag 'BF58'
  cmdResult INTEGER {
    ok(0),
    rollbackNotAllowed(1), -- Usage of rollback was not granted by the eIM
    catBusy(5),
    commandError(7),
    undefinedError(127)
  },
  eUICCPackageResult [81] EuiccPackageResult OPTIONAL
}
-- ASN1STOP

-- Section 5.9.17
-- ASN1START
ConfigureAutoProfileEnablingRequest ::= [89] SEQUENCE { -- Tag 'BF59'
  autoEnableFlag [0] NULL OPTIONAL,
  smdpOid [1] OBJECT IDENTIFIER OPTIONAL,
  smdpAddress [2] UTF8String OPTIONAL
}
-- ASN1STOP
-- ASN1START
ConfigureAutoProfileEnablingResponse ::= [89] SEQUENCE { -- Tag 'BF59'
  configAutoEnableResult [0] INTEGER {
    ok(0),
    insufficientMemory(1),
    unsignedAutoEnableConfigDisallowed(2),
    undefinedError(127)
  }
}
-- ASN1STOP

-- Section 5.9.18
-- ASN1START
GetEimConfigurationDataRequest ::= [85] SEQUENCE { -- Tag 'BF55'
}
-- ASN1STOP
-- ASN1START
GetEimConfigurationDataResponse ::= [85] SEQUENCE { -- Tag 'BF55'
  eimConfigurationDataList [0] SEQUENCE OF EimConfigurationData
}
-- ASN1STOP

-- Section 5.14.2
-- ASN1START
SGP32-PrepareDownloadResponse ::= [33] CHOICE { -- Tag 'BF21'
  downloadResponseOk PrepareDownloadResponseOk,
  downloadResponseError PrepareDownloadResponseError,
  compactDownloadResponseOk CompactPrepareDownloadResponseOk
}
CompactPrepareDownloadResponseOk ::= SEQUENCE {
  compactEuiccSigned2 CompactEuiccSigned2, -- Compact version of EuiccSigned2
  euiccSignature2 [APPLICATION 55] OCTET STRING -- tag '5F37' signature on EuiccSigned2
}
CompactEuiccSigned2 ::= SEQUENCE {
  euiccOtpk [APPLICATION 73] OCTET STRING OPTIONAL, -- otPK.EUICC.ECKA, tag '5F49' euiccOtpk is always present except if bppEuiccOtpk was chosen by the eUICC
  hashCc Octet32 OPTIONAL -- Hash of confirmation code, if not received from Eim
}
-- ASN1STOP

-- Section 5.14.3
-- ASN1START
SGP32-AuthenticateServerResponse ::= [56] CHOICE { -- Tag 'BF38'
  authenticateResponseOk AuthenticateResponseOk,
  authenticateResponseError AuthenticateResponseError,
  compactAuthenticateResponseOk CompactAuthenticateResponseOk
}
CompactAuthenticateResponseOk ::= SEQUENCE {
  signedData CHOICE {
    euiccSigned1 EuiccSigned1,
    compactEuiccSigned1 [0] CompactEuiccSigned1 -- Compact version of EuiccSigned1
  },
  euiccSignature1 [APPLICATION 55] OCTET STRING, -- tag 5F37 signature on EuiccSigned1
  euiccCertificate [1] Certificate OPTIONAL, -- eUICC Certificate (CERT.EUICC.ECDSA)
  eumCertificate [2] Certificate OPTIONAL -- EUM Certificate (CERT.EUM.ECDSA)
}
CompactEuiccSigned1 ::= SEQUENCE {
  extCardResource [4] OCTET STRING, -- Extended Card Resource Information according to ETSI TS 102 226 extracted from euiccInfo2,
  ctxParams1 [2] CtxParams1 OPTIONAL -- ctxParams1 may be left out by IPA if eIM ctxParams1 was received from the eIM
}
-- ASN1STOP

-- Section 5.14.7
-- ASN1START
SGP32-PendingNotification ::= CHOICE {
  profileInstallationResult [55] SGP32-ProfileInstallationResult, -- tag 'BF37'
  otherSignedNotification OtherSignedNotification,
  compactProfileInstallationResult [0] CompactProfileInstallationResult,
  compactOtherSignedNotification [1] CompactOtherSignedNotification
}
SGP32-ProfileInstallationResult ::= [55] SEQUENCE { -- Tag 'BF37'
  profileInstallationResultData [39] ProfileInstallationResultData,
  euiccSignPIR EuiccSignPIR
}
CompactProfileInstallationResult ::= SEQUENCE {
  compactProfileInstallationResultData [0] CompactProfileInstallationResultData,
  euiccSignPIR EuiccSignPIR
}
CompactProfileInstallationResultData ::= SEQUENCE {
  transactionId [0] TransactionId, -- The TransactionID generated by the SM-DP+
  seqNumber INTEGER,
  iccidPresent BOOLEAN DEFAULT TRUE,
  compactFinalResult [2] CHOICE {
    compactSuccessResult CompactSuccessResult,
    errorResult ErrorResult
  }
}
CompactSuccessResult ::= SEQUENCE {
  compactAid [APPLICATION 15] OCTET STRING (SIZE (2)), -- Byte 14 and 15 of ISD-P AID
  simaResponse OCTET STRING OPTIONAL -- MUST be present if the simaResponse value (EUICCResponse) is different from the 9-byte value ‘30 07 A0 05 30 03 80 01 00’ representing success
}
CompactOtherSignedNotification ::= SEQUENCE {
  tbsOtherNotification NotificationMetadata,
  euiccNotificationSignature [APPLICATION 55] OCTET STRING -- eUICC signature of tbsOtherNotification, Tag '5F37'
}
-- ASN1STOP

-- Section 5.14.8
-- ASN1START
SGP32-CancelSessionResponse ::= [65] CHOICE { -- Tag 'BF41'
  cancelSessionResponseOk CancelSessionResponseOk,
  cancelSessionResponseError INTEGER {invalidTransactionId(5), undefinedError(127)},
  compactCancelSessionResponseOk CompactCancelSessionResponseOk
}
CompactCancelSessionResponseOk ::= SEQUENCE {
  compactEuiccCancelSessionSigned CompactEuiccCancelSessionSigned, -- Compact version of euiccCancelSessionSigned
  euiccCancelSessionSignature [APPLICATION 55] OCTET STRING -- tag 5F37 signature on euiccCancelSessionSigned
}
CompactEuiccCancelSessionSigned ::= SEQUENCE {
  reason CancelSessionReason OPTIONAL
}
-- ASN1STOP

-- Section 6.3.1
-- ASN1START
EsipaMessageFromIpaToEim ::= CHOICE {
  initiateAuthenticationRequestEsipa [57] InitiateAuthenticationRequestEsipa, -- Tag 'BF39'
  authenticateClientRequestEsipa [59] AuthenticateClientRequestEsipa, -- Tag 'BF3B'
  getBoundProfilePackageRequestEsipa [58] GetBoundProfilePackageRequestEsipa, -- Tag 'BF3A'
  cancelSessionRequestEsipa [65] CancelSessionRequestEsipa, -- Tag 'BF41'
  handleNotificationEsipa [61] HandleNotificationEsipa, -- Tag 'BF3D'
  transferEimPackageResponse [78] TransferEimPackageResponse, -- Tag 'BF4E'
  getEimPackageRequest [79] GetEimPackageRequest, -- Tag 'BF4F'
  provideEimPackageResult [80] ProvideEimPackageResult -- Tag 'BF50'
}
EsipaMessageFromEimToIpa ::= CHOICE {
  initiateAuthenticationResponseEsipa [57] InitiateAuthenticationResponseEsipa, -- Tag 'BF39'
  authenticateClientResponseEsipa [59] AuthenticateClientResponseEsipa, -- Tag 'BF3B'
  getBoundProfilePackageResponseEsipa [58] GetBoundProfilePackageResponseEsipa, -- Tag 'BF3A'
  cancelSessionResponseEsipa [65] CancelSessionResponseEsipa, -- Tag 'BF41'
  transferEimPackageRequest [78] TransferEimPackageRequest, -- Tag 'BF4E'
  getEimPackageResponse [79] GetEimPackageResponse, -- Tag 'BF4F'
  provideEimPackageResultResponse [80] ProvideEimPackageResultResponse -- Tag 'BF50'
}
-- ASN1STOP

-- Section 6.3.2
-- ASN1START
InitiateAuthenticationRequestEsipa ::= [57] SEQUENCE { -- Tag 'BF39'
  euiccChallenge [1] Octet16, -- random eUICC challenge
  smdpAddress [3] UTF8String OPTIONAL,
  euiccInfo1 EUICCInfo1 OPTIONAL
}
InitiateAuthenticationResponseEsipa ::= [57] CHOICE { -- Tag 'BF39'
  initiateAuthenticationOkEsipa InitiateAuthenticationOkEsipa,
  initiateAuthenticationErrorEsipa INTEGER {
  invalidDpAddress(1),
  euiccVersionNotSupportedByDp(2),
  ciPKIdNotSupported(3),
  smdpAddressMismatch(50),
  smdpOidMismatch(51)
}
}
InitiateAuthenticationOkEsipa ::= SEQUENCE {
  transactionId [0] TransactionId OPTIONAL, -- The TransactionID generated by the SM-DP+
  serverSigned1 ServerSigned1, -- Signed information
  serverSignature1 [APPLICATION 55] OCTET STRING, -- Server Sign1, Tag '5F37'
  euiccCiPKIdToBeUsed OCTET STRING, -- Key identifier (possibly truncated) of the CI Public Key to be used as required by ES10b.AuthenticateServer
  serverCertificate Certificate,
  matchingId UTF8String OPTIONAL,
  ctxParams1 [2] CtxParams1 OPTIONAL
}
-- ASN1STOP

-- Section 6.3.2.2
-- ASN1START
AuthenticateClientRequestEsipa ::= [59] SEQUENCE { -- Tag 'BF3B'
  transactionId [0] TransactionId,
  authenticateServerResponse [56] SGP32-AuthenticateServerResponse -- This is the response from ES10b.AuthenticateServer, possibly in compact format
}
AuthenticateClientResponseEsipa ::= [59] CHOICE { -- Tag 'BF3B'
  authenticateClientOkDPEsipa AuthenticateClientOkDPEsipa,
  authenticateClientOkDSEsipa AuthenticateClientOkDSEsipa,
  authenticateClientErrorEsipa INTEGER {
    eumCertificateInvalid(1),
    eumCertificateExpired(2),
    euiccCertificateInvalid(3),
    euiccCertificateExpired(4),
    euiccSignatureInvalid(5),
    matchingIdRefused(6),
    eidMismatch(7),
    noEligibleProfile(8),
    ciPKUnknown(9),
    invalidTransactionId(10),
    insufficientMemory(11),
    pprNotAllowed(50),
    eventIdUnknown(56),
    undefinedError(127)
  }
}
AuthenticateClientOkDPEsipa ::= SEQUENCE {
  transactionId [0] TransactionId OPTIONAL,
  profileMetaData [37] StoreMetadataRequest OPTIONAL,
  smdpSigned2 SmdpSigned2, -- Signed information
  smdpSignature2 [APPLICATION 55] OCTET STRING, -- Tag '5F37'
  smdpCertificate Certificate, -- CERT.DPpb.ECDSA
  hashCc Octet32 OPTIONAL -- Hash of confirmation code
}
AuthenticateClientOkDSEsipa ::= SEQUENCE {
  transactionId [0] TransactionId,
  profileDownloadTrigger [84] ProfileDownloadTriggerRequest OPTIONAL -- Tag 'BF54'
}
-- ASN1STOP

-- Section 6.3.2.3
-- ASN1START
GetBoundProfilePackageRequestEsipa ::= [58] SEQUENCE { -- Tag 'BF3A'
  transactionId [0] TransactionId,
  prepareDownloadResponse [33] SGP32-PrepareDownloadResponse -- This is the response from ES10b.PrepareDownload, possibly in compact format
}
GetBoundProfilePackageResponseEsipa ::= [58] CHOICE { -- Tag 'BF3A'
  getBoundProfilePackageOkEsipa GetBoundProfilePackageOkEsipa,
  getBoundProfilePackageErrorEsipa INTEGER {
    euiccSignatureInvalid(1),
    confirmationCodeMissing(2),
    confirmationCodeRefused(3),
    confirmationCodeRetriesExceeded(4),
    bppRebindingRefused(5),
    downloadOrderExpired(6),
    profileMetadataMismatch(50),
    invalidTransactionId(95),
    undefinedError(127)
  }
}
GetBoundProfilePackageOkEsipa ::= SEQUENCE {
  transactionId [0] TransactionId OPTIONAL,
  boundProfilePackage [54] BoundProfilePackage
}
-- ASN1STOP

-- Section 6.3.2.4
-- ASN1START
HandleNotificationEsipa ::= [61] CHOICE { -- Tag 'BF3D'
  pendingNotification SGP32-PendingNotification, -- A Notification to be delivered to a Notification Receiver, possibly in compact format
  provideEimPackageResult ProvideEimPackageResult
}
-- ASN1STOP

-- Section 6.3.2.5
-- ASN1START
CancelSessionRequestEsipa ::= [65] SEQUENCE { -- Tag 'BF41'
  transactionId TransactionId,
  cancelSessionResponse SGP32-CancelSessionResponse -- This is the response from ES10b.  CancelSession function, possibly in compact format
}
CancelSessionResponseEsipa ::= [65] CHOICE { -- Tag 'BF41'
  cancelSessionOk SGP32-CancelSessionOk,
  cancelSessionError INTEGER {
    invalidTransactionId(1),
    euiccSignatureInvalid(2),
    undefinedError(127)
  }
}
SGP32-CancelSessionOk ::= SEQUENCE { -- This function has no output data
}
-- ASN1STOP


-- Section 6.3.2.6
-- ASN1START
GetEimPackageRequest ::= [79] SEQUENCE { -- Tag 'BF4F'
  eidValue [APPLICATION 26] Octet16, -- Tag '5A'
  notifyStateChange [0] NULL OPTIONAL, -- Notification to the eIM that it should update its information about the eUICC (e.g. list of profiles, profile states...)
  rPLMN [1] OCTET STRING (SIZE(3)) OPTIONAL -- MCC and MNC of the last registered PLMN, coded as defined in 3GPP TS 24.008 [22]
}
GetEimPackageResponse ::= [79] CHOICE { -- Tag 'BF4F'
  euiccPackageRequest [81] EuiccPackageRequest, -- Tag 'BF51'
  ipaEuiccDataRequest [82] IpaEuiccDataRequest, -- Tag 'BF52'
  profileDownloadTriggerRequest [84] ProfileDownloadTriggerRequest, -- Tag 'BF54'
  eimPackageError INTEGER {
    noEimPackageAvailable(1),
    undefinedError(127)
  }
}
-- ASN1STOP

-- Section 6.3.2.7
-- ASN1START
ProvideEimPackageResult ::= [80] CHOICE { -- Tag 'BF50'
  euiccPackageResult [81] EuiccPackageResult, -- Tag 'BF51'
  ePRAndNotifications SEQUENCE {
    euiccPackageResult [81] EuiccPackageResult, -- Tag 'BF51'
    notificationList [43] SGP32-RetrieveNotificationsListResponse -- Tag 'BF2B'
  },
  ipaEuiccDataResponse [82] IpaEuiccDataResponse, -- Tag 'BF52'
  profileDownloadTriggerResult [84] ProfileDownloadTriggerResult, -- Tag 'BF54'
  eimPackageError INTEGER {
    invalidPackageFormat(1),
    unknownPackage(2),
    undefinedError(127)
  }
}
ProvideEimPackageResultResponse ::= [80] SEQUENCE { -- Tag 'BF50'
  eimAcknowledgements [83] EimAcknowledgements OPTIONAL -- Tag 'BF53'
}
-- ASN1STOP

-- Section 6.3.3.1
-- ASN1START
TransferEimPackageRequest ::= [78] CHOICE { -- Tag 'BF4E'
  euiccPackageRequest [81] EuiccPackageRequest, -- Tag 'BF51'
  ipaEuiccDataRequest [82] IpaEuiccDataRequest, -- Tag 'BF52'
  eimAcknowledgements [83] EimAcknowledgements, -- Tag 'BF53'
  profileDownloadTriggerRequest [84] ProfileDownloadTriggerRequest -- Tag 'BF54'
}
TransferEimPackageResponse ::= [78] CHOICE { -- Tag 'BF4E'
  euiccPackageResult [81] EuiccPackageResult, -- Tag 'BF51'
  ePRAndNotifications SEQUENCE {
    euiccPackageResult [81] EuiccPackageResult, -- Tag 'BF51'
    notificationList [43] SGP32-RetrieveNotificationsListResponse -- Tag 'BF2B'
  },
  ipaEuiccDataResponse [82] IpaEuiccDataResponse, -- Tag 'BF52'
  eimPackageReceived NULL,
  eimPackageError INTEGER {
    invalidPackageFormat(1),
    unknownPackage(2),
    undefinedError(127)
  }
}
-- ASN1STOP


END
