Package: android.hardware.secure_element@1.0

ISecureElement

interface ISecureElement

According to ISO/IEC 7816

Methods

init

init (ISecureElementHalCallback clientCallback)

Initializes the Secure Element.This may include updating the applet and/or vendor-specific initialization.

HAL service must send onStateChange() with connected equal to true after all the initialization has been successfully completed.Clients must wait for a onStateChange(true)before opening channels.

Details
Parameters
clientCallback
callback used to sent status of the SE back to the client

getAtr

getAtr ()
generates (vec<uint8_t> response)

Returns Answer to Reset as per ISO/IEC 7816

Details
Generates
response
containing the response.Empty vector if Secure Element doesn't support ATR.

isCardPresent

isCardPresent ()
generates (bool present)

Returns the current state of the card.

This is particularly useful for removable Secure Elements like UICC, Secure Elements on SD cards etc.

Details
Generates
present
true if present, false otherwise

transmit

transmit (vec<uint8_t> data)
generates (vec<uint8_t> response)

Transmits an APDU command(as per ISO/IEC 7816)to the SE.

Details
Parameters
data
APDU command to be sent
Generates
response
to the command.In case of error in communicating with the secure element, an empty vector is returned.

openLogicalChannel

openLogicalChannel (vec<uint8_t> aid, uint8_t p2)
generates (LogicalChannelResponse response, SecureElementStatus status)

Opens a logical channel with the Secure Element, selecting the applet represented by the Application ID(AID).

Details
Parameters
aid
AID to uniquely identify the applet on the Secure Element
p2
P2 paramter of SELECT APDU as per ISO 7816-4
Generates
response
On success, response to SELECT command is returned empty vector on failure.
status
SecureElementStatus::SUCCESS on success, SecureElementStatus::CHANNEL_NOT_AVAILABLE if secure element has reached the maximum limit on the number of channels it can support, SecureElementStatus::NO_SUCH_ELEMENT_ERROR if AID provided doesn't match any applet on the secure element and SecureElementStatus::UNSUPPORTED_OPERATION if operation provided by the P2 parameter is not permitted by the applet.SecureElementStatus::IOERROR if there was an error communicating with the Secure Element.

openBasicChannel

openBasicChannel (vec<uint8_t> aid, uint8_t p2)
generates (vec<uint8_t> selectResponse, SecureElementStatus status)

Opens a basic channel with the Secure Element, selecting the applet represented by the Application ID(AID).

Details
Parameters
aid
AID to uniquely identify the applet on the Secure Element
p2
P2 paramter of SELECT APDU as per ISO 7816-4
Generates
selectResponse
On success, response to SELECT command is returned empty vector on failure.
status
SecureElementStatus::SUCCESS on success, SecureElementStatus::CHANNEL_NOT_AVAILABLE if secure element has reached the maximum limit on the number of channels it can support, SecureElementStatus::NO_SUCH_ELEMENT_ERROR if AID provided doesn't match any applet on the secure element and SecureElementStatus::UNSUPPORTED_OPERATION if operation provided by the P2 parameter is not permitted by the applet.SecureElementStatus::IOERROR if there was an error communicating with the Secure Element.

closeChannel

closeChannel (uint8_t channelNumber)
generates (SecureElementStatus status)

Closes the channel indicated by the channelNumber.

Closing a basic channel, i.e with channelNumber 0 must return SecureElementStatus::FAILED.

Details
Parameters
channelNumber
to be closed
Generates
status
SecureElementStatus::SUCCESS on success and SecureElementStatus::FAILED on error.