作者归档:softsim

Watch

/System/Library/PrivateFrameworks/CellularPlanManager.framework/CellularPlanManager
/System/Library/PrivateFrameworks/CellularPlanManager.framework/Contents/MacOS/CellularPlanManager
/System/Library/PrivateFrameworks/CellularBridgeUI.framework/CellularBridgeUI

—————
共享缓存机制

在iOS系统中,每个程序依赖的动态库都需要通过dyld(位于/usr/lib/dyld)一个一个加载到内存,然而,很多系统库几乎是每个程序都会用到的,如果在每个程序运行的时候都重复的去加载一次,势必造成运行缓慢,为了优化启动速度和提高程序性能,共享缓存机制就应运而生。所有默认的动态链接库被合并成一个大的缓存文件,放到/System/Library/Caches/com.apple.dyld/目录下,按不同的架构保存分别保存着
dyld_shared_cache_arm64 到 dyld_shared_cache_arm64.5

想要分析某个系统库,就需要从dyld_shared_cache里先将的原始二进制文件提取出来
———–
-[CTCellularPlanManager remotePlanLaunchInfoForEid:completion:]
-[CTCellularPlanManager didCancelRemotePlan]
-[CTCellularPlanManager pendingReleaseRemotePlan]
-[CTCellularPlanManager subscriptionDetailsForCompletion:]
-[CTCellularPlanManager didPurchaseRemotePlanForEid:imei:meid:iccid:alternateSmdpFqdn:completion:]
-[CTCellularPlanManager eraseAllRemotePlansWithCompletion:]
————————————————————————
-[CTCellularPlanItem initWithCellularPlan:uuid:iccid:name:type:phoneNumber:label:isLocalTransferToeSIMSupported:isTransferred:transferredStatus:transferredToDeviceDisplayName:]

-[CTCellularPlanItem initWithCellularPlan:uuid:type:phoneNumber:label:transferredStatus:transferredToDeviceDisplayName:]

-[CTCellularPlanItem initWithIccid:uuid:name:phoneNumber:label:isLocalTransferToeSIMSupported:isTransferred:transferredStatus:transferredToDeviceDisplayName:]

-[CTCellularPlanItem isLocalTransferToeSIMSupported]
-[CTCellularPlanItem setIsLocalTransferToeSIMSupported:]
————————-
-[CTCellularPlanManager setIMEIPrefix:]
-[CTCellularPlanManager getESimServerURL:]
-[CTCellularPlanManager setESimServerURL:]
———————-
int -[COSAboutDataSource getIMEI:]
void -[COSAboutDataSource getCarrierInfo:]
int -[COSAboutDataSource getSerialNumber:]
-(int)getDeviceModel:(int)
————————-
-[COSEIDDetailsController EIDString:]
———————-
+[NPHSharedUtilities isActiveWatchChinaRegionCellular]:
int -[NPHCellularBridgeUIManager startRemoteProvisioning]

-[CTCellularPlanManager addNewPlanWithUserInWebsheetWithUserConsent:completion:]
-[CTCellularPlanManager didPurchasePlanForCsn:iccid:profileServer:state:]
-[CTCellularPlanManager remotePlanLaunchInfoForEid:completion:]
CellularPlanManager这个文件
-[CTCellularPlanManager loadPlansWithUrl:postData:completion:] 联通应该是用这样

-[CTCellularPlanManager setSkipEligibilityCheck:] 跳过条件检查
-[CTCellularPlanManager getSkipEligibilityCheck:]
-[CTCellularPlanManager openInternalUrlId:]
-[CTCellularPlanManager setESimServerURL:]
-[CTCellularPlanManager getESimServerURL:]
-[CTCellularPlanManager getRemoteInfo:]
-[CTCellularPlanManager getIMEIPrefix:]
-[CTCellularPlanManager addNewRemotePlanWithAddress:matchingId:oid:confirmationCode:isPairing:withCSN:withContext:userConsent:completion:]
CTCellularPlanRequest
initWithUrl:(int)arg2 httpMethod:(int)arg3 httpHeaders:(int)arg4 httpBody

-[CTCellularPlanRequest initPostWithUrl:]
initJsonPostWithUrl
initJsonPostWithUrl
-[CTCellularPlanRequest initGetWithUrl:]
loadPlansWithUrl:(int)arg2 postData:(int)arg3 completion

+[CTCellularPlanRequest(Factory) loadPlansRequestWithUrl:postData:]

esim操作apdu实例解析

ETSI TS 102 221 V17.4.0 (2023-02)
TERMINAL CAPABILITY
————————-
GPC_SPE_007

Global Platform Card Specification – Public Release v2.3.1

The STORE DATA command message shall be coded according to the following table.

P1= 91
Last block
命令的数据域是 BER-TLV 格式

DER编码
GetEID== Tag ‘BF3E’ (GetEuiccDataRequest)
The data field SHALL indicate EID data object ‘5C 01 5A’ (tag ‘5A’ identifies the EID).
tag ‘5C’

响应 Tag ‘BF3E’
tag ‘5A’

============================
ProfileInfoListRequest ‘BF2D’
EnableProfileRequest Tag ‘BF31’
DisableProfileRequest ‘BF32’
DeleteProfileRequest ‘BF33’

GetEuiccDataResponse ‘BF3E’
————————————————–
Send Terminal Capabilities

80 aa 00 00 0a a9088100820101830107

回应

9000


Open Logical Channel and Select ISD-R

00a4040010 a0000005591010ffffffff8900000100

响应

6f81818410a0000005591010ffffffff8900000100a566735706072a864886fc6b01600b06092a864886fc6b020202630906072a864886fc6b03640b06092a864886fc6b048000650d060b2a864886fc6b05040200006618060a2b060104012a026e0103060a5354333347314d3201019f6e060077831801019f6501ffe0058203020200

9000


get status
80f2000c00

list profile
81 E2 91 00 03 BF2D00


获取EID
81 e2 91 00 06 bf3e 03 5c 01 5a


getEuiccConfiguredAddresses
81 E2 91 00 03 BF3C00

bf 3c
32
80 1f 6573696d2e7968647a642e6368696e616d6f62696c652e636f6d3a38303031 (esim.yhdzd.chinamobile.com:8001)
81 0f 6c70612e64732e67736d612e636f6d (lpa.ds.gsma.com)
9000


Enable Profile
81 E2 91 00 1A BF31 17 A0 12 4F 10 A0000005591010FFFFFFFF8900001100 8101FF

eSim Profile

eSim Profile含有:

1个MNO-SD (卡上的运营商代表,含有OTA密钥,提供安全的OTA通道)

SSD(补充安全域)和CASD

Applets

应用(比如NFC应用)

NAAs (SIM核心元素,Network Access Application== Application residing in a Profile providing authorisation to access
a network)

文件系统的其它元素

Profile metadata(包括Profile Policy Rules)


保护与传输
Unprotected Profile Package (UPP): 未保护的Profile包,原始的 TLV 序列
Protected Profile Package (PPP): 以BSP负载TLV形式 组成的 分段保护的包
Bound Profile Package (BPP):
Segmented Bound Profile Package (SBPP): 可以用STORE DATA命令存入UICC的形式


Local Discovery Service
Local Profile Download
Local User Interface

SM-DS 的作用是提供一种机制, 允许 SM-DP+ 去通知 希望与之通信的任何设备中 的 LDS 。
SM-DS 到 LDS 通信的目的,是告诉它有一个待处理的事件。
SM-DP+ 会为 目标设备的LDS 发送一条到 SM-DS 的 事件注册消息。

在简单部署中,仅在 eUICC 上配置 Root SM-DS。 Root SM-DS地址是唯一的,填写在eUICC中。

目标设备中的 LDS 使用同样的逻辑位置 去 轮询 Root SM-DS 。
当Root SM-DS 具有目标设备的事件 ID 时, 它将使用 SM-DP+ 地址,对这次轮询进行响应;
如果没有事件 ID,则 回 一个空响应。

在级联SM-DSs的部署中, SM-DP+ 将发送一条事件注册消息 给 一个替代的SM-DS, 这个SM-DS可能没有被配置成Root SM-DS.
但是这个替代的SM-DS会将事件注册消息 级联地发给Root SM-DS.

目标设备中的LDS, 轮询Root SM-DS时,就会收到 替代的SM-DS地址。 然后LDS将向 替代的SM-DS发出 事件请求, 对应的SM-DS会响应
SM-DP+的地址。

Root SM-DS服务器由GSMA管理, 只通过同一个地址访问,后面有很多台物理服务器担当服务。

esim概念解析

Embedded UICC Controlling Authority Security Domain (ECASD) 负责安全存储支持 eUICC 上所需安全域所需的凭证。

一个 eUICC 上应该只有一个 ECASD。 ECASD 应在 eUICC 制造期间由 EUM (卡商) 安装和个性化,如 GlobalPlatform 卡规范中所述。

ECASD 应包含以下内容:

1. 用于创建签名的 eUICC 私钥      eUICC’s Private Key(s) (SK.EUICC.SIG) 。
2. eUICC认证的证书 (CERT.EUICC.SIG), 此证书含有eUICC的公钥 (PK.EUICC.SIG)。
3. 用于验证 SM-DP+ 和 SM-DS 证书的证书颁发者 (CI) 根证书的公钥 (PK.CI.SIG) 。
4. eUICC 制造商 (EUM) 用于 更新 密钥/证书的密钥集 ((CERT.EUM.SIG)。

      可以更新:

         1)eUICC’s Private Key(s) 和 Certificate(s)

         2)  EUM Certificate(s)

        3)  eSIM CA RootCA public key(s)

       4)  添加 新的 new eUICC Private Key(s), eUICC Certificate(s), EUM Certificate(s)

      5) 

此外,ECASD 应提供在密钥建立和 eUICC 身份验证期间使用的安全功能。


ISD-R 负责创建新的 ISD-P 和 管理 所有 ISD-P 的生命周期。


ISD-P 是用于托管 配置文件(Profile)的安全容器(安全域)。 ISD-P 与配置文件包解释器(用于对接收到的绑定配置文件包,进行解码/解释) 协作, 来完成配置文件下载和安装.

ISD-P是 SM-DP+ 在卡上的代表。


MNO-SD
MNO-SD 是发布配置文件的运营商的卡上代表。 它包含运营商的无线 (OTA) 密钥并提供安全的 OTA 通道。


Profile Policy Enabler
eUICC 操作系统 (OS) 的一个服务,提供配置文件策略规则验证和执行。


Telecom Framework
Telecom Framework 是一种操作系统服务,它为 ISD-P 中托管的 NAA(SIM卡应用) 提供标准化的网络认证算法。 此外,它还提供了使用必要参数配置算法的能力。


Profile Package 解释器是一个 eUICC 操作系统服务,它 将 Profile Package Data 转换为 目标 eUICC 的特定内部格式 的Profile.


LPA 服务

提供 对 (LPA功能要求中定义的)的服务和数据的访问,包括:
1. root SM-DS地址。
2. 可选存储的默认 SM-DP+ 地址。
3. 便于接收从 LPA 传输的绑定配置文件包。(从LPAd传到ISD-P)
4. 提供有关已安装配置文件及其配置文件元数据的信息。
5. 提供本地配置文件管理
6. 支持远程配置文件管理操作
7. 为LPA 提供与SM-DS 进行身份验证和交互的功能。
8. 确保对 EID 的访问仅限于 LPA。

dart-在model classes里序列化JSON

user.dart

class User {
  final String name;
  final String email;

  User(this.name, this.email);

  User.fromJson(Map<String, dynamic> json)
      : name = json['name'],
        email = json['email'];

  Map<string, dynamic> toJson() => {
        'name': name,
        'email': email,
      };
}

hello.dart

import 'dart:convert';
import 'user.dart';

String jsonString = '''
{
  "name": "John Smith",
  "email": "john@example.com"
}
''';


void main() {
    Map<String, dynamic> userMap = jsonDecode(jsonString);

    var user = User.fromJson(userMap);

    print('Howdy, ${user.name}!');
    print('We sent the verification link to ${user.email}.');

    String json = jsonEncode(user);
    print(json);
}

被调用的代码根本不需要担心序列化 JSON 数据的问题。然而,你仍然需要模型类。你当然会希望序列化数据在一个生产环境的应用里能奏效。在实践中,User.fromJson() 和 User.toJson() 方法都需要单元测试以便验证正确的行为。

使用 dart:convert 手动序列化 JSON 数据

将下列内容保存为 hello.dart

import 'dart:convert';


String jsonString = '''
{
  "name": "John Smith",
  "email": "john@example.com"
}
''';



void main() {

    Map user = jsonDecode(jsonString);

    print('Howdy, ${user['name']}!');
    print('We sent the verification link to ${user['email']}.');
}

运行
dart hello.dart

各运营商的VoWiFI服务

统一由3gpp来管理的

https://www.freecheckdomain.com/cn/dnsCheck.html
https://dnschecker.org/
来检测

中国联通,此域名不存在
epdg.epc.mnc001.mcc460.pub.3gppnetwork.org


马来 U Mobile
epdg.epc.mnc018.mcc502.pub.3gppnetwork.org
123.136.110.180
123.136.100.132


泰国 AIS
epdg.epc.mnc003.mcc520.pub.3gppnetwork.org
119.31.121.14
119.31.123.26


MCC 520 泰国 Thailand
MNC 01 AIS
03 AIS
15 AIS
23 AIS
—————
MCC 502 马来西亚 Malaysia
01 Telekom
11 MTX Utara
12 Maxis
13 TM Touch
16 DIGI
17 Maxis
18 U Mobile
—————

epdg.epc.mnc260.mcc310.pub.3gppnetwork.org CNAME epdg.epc.geo.mnc260.mcc310.pub.3gppnetwork.org
epdg.epc.geo.mnc260.mcc310.pub.3gppnetwork.org 208.54.36.3
208.54.40.3
208.54.148.227
208.54.87.3
208.54.2.67
208.54.39.35 (可用)

epdg.epc.mnc260.mcc310.pub.3gppnetwork.org epdg.epc.geo.mnc260.mcc310.pub.3gppnetwork.org
208.54.2.67 (可用)
————-

UDP port 500或4500 是 Internet Security Association and Key Management Protocol (ISAKMP)

UDP PORT 4500是 UDP-encapsulated ESP and IKE
——————–
在OpenWRT的 /etc/config/firewall里有放行的配置

config rule                 
        option name 'Allow-IPSec-ESP'
        option src 'wan'       
        option dest 'lan'
        option proto 'esp'   
        option target 'ACCEPT'   

config rule                   
        option name 'Allow-ISAKMP'
        option src 'wan'              
        option dest 'lan'    
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

IPSEC建立分为三个阶段:phase1(建立IKE SA)、phase1.5(xauth,可选)、phase2(建立最终SA并协商SA参数)

IPSEC建立好之后,用ESP协议封装报文。ESP是等同于UDP\TCP的协议,IP协议号是50(因此ESP并不是UDP的上层协议,而是跟UDP\TCP平行协议)

当IKE在阶段一进行NAT监测时候,发现网络中存在NAT,IKE会把端口从500改到4500,后续的ESP流量前面加一个UDP的头,端口4500

在vowifi场景下,NAT是肯定存在的,所以500端口只有第一个请求才会用到,后面都是4500,(而且4500这个 UDP-encapsulated ESP and IKE是不可以配置和更改的,是RFC规定死的 )。

高通基带MBN

/vendor/firmware_mnt 独立分区

/vendor/firmware_mnt/image
vsimapp
voicepri
modem

/vendor/firmware_mnt/image/modem_pr/mcfg/configs/mcfg_sw
SEA 东南亚 下面有泰国的 AIS, 菲律宾 Globe, 马来 UMobile

UMobile/Commercial/Malaysia/mcfg_sw.mbn
Globe/Commercial/PH/mcfg_sw.mbn
AIS/Commercial/Thailand/mcfg_sw.mbn

China/CU/Commercial/OpenMkt/mcfg_sw.mbn
China/CU/Commercial/VoLTE/mcfg_sw.mbn
China/CMCC/Commercial/Volte_OpenMkt/mcfg_sw.mbn