惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园_首页
V
Visual Studio Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
月光博客
月光博客

博客园 - CHHC

从服务端到桌面端:Go + HTML 多端交付方案 跨平台桌面应用(内嵌 Web 界面 + Go RESTful API 服务) Dify 网页爬虫 Ai常用工具 Dify公司内部知识库权限隔离 智能体:OA行政助手 dify4: test-doc dify3: test-api dify2: test-image dify1: test-local-ollama 访问本地大模型 docker + dify + ollma 安装与配置 dify使用 eSIM SGP32 IPAd 适配移远EC200A OpenCPU 公钥解析 eSIM SGP32 自建符合GSMA规范的eIM平台(支持SGP32及SGP22卡接入) eSIM SGP32 eIM GSMA转码器(支持net及java) eSIM SGP32 证书 eSIM SGP32 生成eUICC所需的配置数据 eSIM SGP32 EuiccPackage包eimSignature和euiccSignEPR生成及校验 eSIM SGP32/SGP22 EUICC.SDK - IPAd RTSPShape-包含服务端及客户端 树莓派安装与配置 NetCore树莓派桌面应用程序 C#解析TLV数据(der -> asn1) golang 项目依赖备份 SGP32笔记 eSIM SGP.22 LPA程序开发 - 协议解析 eSIM SGP.22 LPA程序开发 - 实现功能 PGP文件加解密 vscode配置c/c++环境
SoftSIM - swSIM
CHHC · 2025-12-25 · via 博客园 - CHHC

https://github.com/tomasz-lisowski/swsim

编译

服务器端 swicc-pcsc
sudo apt-get install make cmake gcc pkg-config libpcsclite1 libpcsclite-dev pcscd git clone
--recurse-submodules https://github.com/tomasz-lisowski/swicc-pcsc MakeFile去除 -Werror \ cd swicc-pcsc make main-dbg sudo make install 客户端 swsim sudo apt-get install make gcc git clone --recurse-submodules https://github.com/tomasz-lisowski/swsim MakeFile去除 -Werror \ cd swsim make main-dbg

启动

读卡器启动: sudo pcscd -f -d -T 停止: pkill -x pcscd
swsim启动:cd swsim && ./build/swsim.elf --ip 127.0.0.1 --port 37324 --fs filesystem.swiccfs --fs-gen ./data/usim.json

测试

sudo apt install python-pip
sudo apt install python3-pyscard
python3 test_swsim.py
# -*- coding: utf-8 -*-
from smartcard.System import readers
from smartcard.util import toHexString

def hex_to_string(hex_list):
    """将十六进制列表转换为可读的字符串(用于BCD编码的数字)"""
    result = ""
    for byte in hex_list:
        high = (byte >> 4) & 0x0F
        low = byte & 0x0F
        # 处理可能存在的填充位 (0xF)
        if high != 0x0F:
            result += str(high)
        if low != 0x0F:
            result += str(low)
    return result

# 1. 查找读卡器
reader_list = readers()
swicc_readers = [r for r in reader_list if 'swICC' in str(r)]
if not swicc_readers:
    print("错误:未找到swICC读卡器。请确保swSIM服务器正在另一个终端运行。")
    exit(1)

swicc_reader = swicc_readers[0]
print(f"已连接到: {swicc_reader}")

# 2. 连接
connection = swicc_reader.createConnection()
connection.connect()

print("\n=== 开始读取SIM卡信息 ===\n")

# 3. 读取ICCID (文件ID: 2FE2,位于MF下)
print("1. 正在读取ICCID...")

SELECT_MF = [0xA0, 0xA4, 0x00, 0x00, 0x02, 0x2F, 0xE2]
resp, sw1, sw2 = connection.transmit(SELECT_MF)
print(f"   选择MF状态: {hex(sw1)} {hex(sw2)}")

SELECT_ICCID = [0xA0, 0xB0, 0x00, 0x00, 0x00A]
iccid_data, sw1, sw2 = connection.transmit(SELECT_ICCID)
print(f"   ICCID原始数据: {toHexString(iccid_data)}") 
 

image