1# ISecureElementInterface 2 3 4## 概述 5 6声明由SecureElement模块提供的用于获取SecureElement操作的API, 请参阅“Open Mobile API 规范”。 7 8**起始版本:** 4.0 9 10**相关模块:**[HdiSecureElement](_hdi_secure_element.md) 11 12 13## 汇总 14 15 16### Public 成员函数 17 18| 名称 | 描述 | 19| -------- | -------- | 20| [init](#init) ([in] [ISecureElementCallback](interface_i_secure_element_callback.md) clientCallback, [out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 初始化安全单元。 | 21| [getAtr](#getatr) ([out] List< unsigned char > response) | 获取此SE的ATR。 | 22| [isSecureElementPresent](#issecureelementpresent) ([out] boolean present) | 检查当前的安全单元是否可用。 | 23| [openLogicalChannel](#openlogicalchannel) ([in] List< unsigned char > aid, [in] unsigned char p2, [out] List< unsigned char > response, [out] unsigned char channelNumber, [out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 使用SE打开一个逻辑通道,选择由给定AID代表的应用(当AID不为Null且AID的长度不为0时)。 | 24| [openBasicChannel](#openbasicchannel) ([in] List< unsigned char > aid, [in] unsigned char p2, [out] List< unsigned char > response, [out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 访问[ISO 7816-4]中定义的基本通道(编号为0的通道)。所获得的对象是Channel类的一个实例。 | 25| [closeChannel](#closechannel) ([in] unsigned char channelNumber, [out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 关闭此SE的逻辑通道。关闭基本通道必须返回SecureElementStatus::FAILED。 | 26| [transmit](#transmit) ([in] List< unsigned char > command, [out] List< unsigned char > response, [out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 向SE发送APDU指令(根据协议ISO/IEC 7816)。 | 27| [reset](#reset) ([out] enum [SecureElementStatus](_hdi_secure_element.md#secureelementstatus) status) | 向SE发送APDU指令(根据协议ISO/IEC 7816)。 | 28 29 30## 成员函数说明 31 32 33### closeChannel() 34 35``` 36ISecureElementInterface::closeChannel ([in] unsigned char channelNumber, [out] enum SecureElementStatus status ) 37``` 38 39**描述** 40 41关闭此SE的逻辑通道。关闭基本通道必须返回SecureElementStatus::FAILED。 42 43**起始版本:** 4.0 44 45**参数:** 46 47| 名称 | 描述 | 48| -------- | -------- | 49| channelNumber | 要关闭的逻辑通道编号。 | 50| status | 需要关闭的逻辑通道的状态。 | 51 52 53### getAtr() 54 55``` 56ISecureElementInterface::getAtr ([out] List< unsigned char > response) 57``` 58 59**描述** 60 61获取此SE的ATR。 62 63**起始版本:** 4.0 64 65**参数:** 66 67| 名称 | 描述 | 68| -------- | -------- | 69| response | 返回SE的ATR,SE的ATR不可用时,返回空的数组。 | 70 71 72### init() 73 74``` 75ISecureElementInterface::init ([in] ISecureElementCallback clientCallback, [out] enum SecureElementStatus status ) 76``` 77 78**描述** 79 80初始化安全单元。 81 82**起始版本:** 4.0 83 84**参数:** 85 86| 名称 | 描述 | 87| -------- | -------- | 88| callback | 用于通知SE状态更改的回调。 | 89| status | 初始化SE的状态。 | 90 91 92### isSecureElementPresent() 93 94``` 95ISecureElementInterface::isSecureElementPresent ([out] boolean present) 96``` 97 98**描述** 99 100检查当前的安全单元是否可用。 101 102**起始版本:** 4.0 103 104**参数:** 105 106| 名称 | 描述 | 107| -------- | -------- | 108| present | 如果安全单元可用,则present等于True,否则为false。 | 109 110 111### openBasicChannel() 112 113``` 114ISecureElementInterface::openBasicChannel ([in] List< unsigned char > aid, [in] unsigned char p2, [out] List< unsigned char > response, [out] enum SecureElementStatus status ) 115``` 116 117**描述** 118 119访问[ISO 7816-4]中定义的基本通道(编号为0的通道)。所获得的对象是Channel类的一个实例。 120 121**起始版本:** 4.0 122 123**参数:** 124 125| 名称 | 描述 | 126| -------- | -------- | 127| aid | 要在此通道上选择的应用的AID的byte数组。 | 128| p2 | 在该通道上执行的SELECT APDU。 | 129| response | SELECT指令的响应,如果失败则为空。 | 130| status | 打开基本通道的状态。 | 131 132 133### openLogicalChannel() 134 135``` 136ISecureElementInterface::openLogicalChannel ([in] List< unsigned char > aid, [in] unsigned char p2, [out] List< unsigned char > response, [out] unsigned char channelNumber, [out] enum SecureElementStatus status ) 137``` 138 139**描述** 140 141使用SE打开一个逻辑通道,选择由给定AID代表的应用(当AID不为Null且AID的长度不为0时)。 142 143**起始版本:** 4.0 144 145**参数:** 146 147| 名称 | 描述 | 148| -------- | -------- | 149| aid | 要在此通道上选择的应用的AID的byte数组。 | 150| p2 | 在该通道上执行的SELECT APDU。 | 151| response | 对SELECT指令的响应,如果失败则为空。 | 152| channelNumber | 新逻辑通道的通道编号。 | 153| status | 打开逻辑通道的状态。 | 154 155 156### reset() 157 158``` 159ISecureElementInterface::reset ([out] enum SecureElementStatus status) 160``` 161 162**描述** 163 164向SE发送APDU指令(根据协议ISO/IEC 7816)。 165 166**起始版本:** 4.0 167 168**参数:** 169 170| 名称 | 描述 | 171| -------- | -------- | 172| status | 重置安全单元的状态。 | 173 174 175### transmit() 176 177``` 178ISecureElementInterface::transmit ([in] List< unsigned char > command, [out] List< unsigned char > response, [out] enum SecureElementStatus status ) 179``` 180 181**描述** 182 183向SE发送APDU指令(根据协议ISO/IEC 7816)。 184 185**起始版本:** 4.0 186 187**参数:** 188 189| 名称 | 描述 | 190| -------- | -------- | 191| command | 要发送的byte数组格式的APDU指令。 | 192| response | 以byte数组接收到的响应。 | 193| status | 传输指令的状态。 | 194