Android Wi-Fi EAP-SIM代码解析

1. wpa_supplicant

During the process of EAP-SIM Authentication, wpa_supplicant will send APDU-Command:"SELECT" to ApduService.

  1. The "SELECT" Command means to select one file from the file system of SIM Card

  2. The right APDU-Response is 0x61, or 0x6c, or 0x9f, which means the APDU-Command executed successfully;

  3. The wrong APDU-Response is 0x6a82, which means "Selected file not found", according to the protocol: ETSI GSM 11.11

    scard_get_imsi()
         |-->scard_select_file()
               |-->_scard_select_file()
                    |-->scard_transmit()
                         |-->SCardTransmit()
                              |-->(1)socket_local_client()-->open socket and connect
                              |      |-->socket()
                              |      |-->socket_local_client_connect()
                              |           |-->connect()
                              |-->(2)send()
                              |-->(3)select()
                              |-->(4)recv()

2. ApduService

The ApduService is responsible for setting up a Unix socket when Wifi starts and listening for incoming connections.
Data read from the socket will be parsed and transmitted as a APDU Command to Telephony.
The response will be sent back over the socket. The socket's name is sent to the wpa supplicant.

frameworks/opt/net/wifi/service/java/com/android/server/wifi/ApduService.java 
 
 

    runService()
     |-->(1)waitForConnection()
     |        |-->ServerSocket.accept()
     |-->(2)communicationWithClient()
              |-->ConnectionSocket.getInputStream()
              |-->ConnectionSocket.getOutputStream()
              |-->phone.iccTransmitApduBasicChannel()

3. PhoneInterfaceManager 

/packages/services/Telephony/src/com/android/phone/PhoneInterfaceManager.java

(1) important events:
	EVENT_TRANSMIT_APDU_LOGIC_CHANNEL_DONE   
	EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE   
(2) important commands:   
	CMD_TRANSMIT_APDU_LOGIC_CHANNEL   
	CMD_TRANSMIT_APDU_BASIC_CHANNEL   
(3) important methods:   
	iccTransmitApduLogicalChannel()   
	iccTransmitApduBasicChannel()   
(4) related System Property:   
	[gsm.sim.operator.numeric] 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值