Chris Mode51
3 min readOct 2, 2023

--

eSIM RSP SM-DP+ Understanding Profile Download and Installation Part 3: InitialiseSecureChannelRequest

When the complete GetBoundProfilePackage response, as described in the previous article, is received by the LPAd an InitialiseSecureChannelRequest payload will be used to setup a new tunneled interface, ES8+, between the SM-DP+ and the eUICC.

Note that this is still relayed data — there isn’t an active tunnel. The LPAd still sends on the TLVs to the eUICC, after segmenting them, having first received them from the SM-DP+ :

This is the ASN.1 definition of InitialiseSecureChannelRequest:

The payload includes the RemoteOpId which is set to installBoundProfilePackage, the TransactionID and a ControlRefTemplate.

Notice the controlRefTemplate comment:

Current specification considers a subset of CRT specified in GlobalPlatform Card Specification Amendment F [13] section 6.5.2.3 for the Mutual Authentication Data Field

..and:

Key type according to GlobalPlatform Card Specification [8] Table 11–16, Tag ‘80’, here set to AES as indicated by the value ‘88’:

// initialiseSecureChannelRequest
BF23 81 49

// RemoteOpId TLV where val = 1 = installBoundProfilePackage
82 01 01

// Transaction ID
80 10 00 11 22 33 44 55 66 77 88 99 aa cc dd ee ff

// ControlRefTemplate
A6 0C

// AES key type
80 01 88

// AES Key Len 16
81 01 10

// Host ID
84 04 01 02 03 04

// smdpOtpk generated in step 1 as otPK.DP.KA
5F 49 10
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff

The use of AES is discussed in the next article, Command TLV MAC & Encryption Keys.

The final entry in the InitialiseSecureChannelRequest payload is smdpSign:

smdpSign [APPLICATION 55] OCTET STRING -- SM-DP's signature, tag '5F37

smdpSign is a signature produced by first appending the euiccOtpk to the incomplete InitialiseSecureChannelRequest payload above. This value is provided within euiccSigned2 from the prepareDownloadResponse sent in the GetBoundProfilePackage request:

// initialiseSecureChannelRequest

...
// smdpOtpk generated in step 1 as otPK.DP.KA
5F 49 10
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff

// euiccOtpk from euiccSigned2
5F 37 10
11 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff

This input data is SHA256 hashed and then ECDSA is used to produce the signature, smdpSign, using an SGP.26 DPpb private key, eg. SK_S_SM_DPpb_ECDSA_NIST.der.

Now append smdpSign to the original initialiseSecureChannelRequest to produce the completed payload:

// initialiseSecureChannelRequest
BF23 81 49

// RemoteOpId TLV where val = 1 = installBoundProfilePackage
82 01 01

// Transaction ID
80 10 00 11 22 33 44 55 66 77 88 99 aa cc dd ee ff

// ControlRefTemplate
A6 0C

// AES key type
80 01 88

// AES Key Len 16
81 01 10

// Host ID
84 04 01 02 03 04

// smdpOtpk generated in step 1 as otPK.DP.KA
5F 49 10
00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff

// smdpSign
5F 37 10
a3 78 62 68 95 10 ba 70 9f 03 aa bb cc dd ee ff

New articles in this series are coming soon, please follow us to find out more!

--

--