Assuming the SIM card is a JavaCard containing a custom applet, is it possible for an app on the phone to send APDU commands to the SIM?

we are looking at developing a custom JavaCard applet to execute on a SIM card and want to access the applet functions from an iOS app. What iOS API can be used to communicate with the SIM (for example, send APDU requests and process responses)? I have seen example code that appears to be using an object of type PBSmartcardStatus and a "smartcard" object that responds to the method "transmit: withCommandLength: andReponseBuffer: andResponseLength" but I cannot find any reference to either of these in any reference manual?

Replies

iOS has no public API for interacting with JavaCard applets.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/

Is it still the case with iOS10 announced yesterday (there is apparently now a smartcard API) ?

Is it still the case with iOS10 announced yesterday

Yes.

App developers can get to the credentials stored in a smartcard appear via the keychain API and use keys SecKey API, but that doesn’t provide a direct path to JavaCard applets on the SIM.

I’ve removed the text above because I’m not 100% sure what the current state of affairs is with regards apps getting access to smartcard-based credentials on iOS. However, that’s not the subject of this thread.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I found TKSmartCard to operation smart card by macOS SDK with xcode8 beta3 API Document,but not found anything with ios SDK,so, i have a question: is there really a smartcard API with ios10?

is there really a smartcard API with ios10?

iOS 10 has no public API for interacting with smardcards directly. Right now CryptoTokenKit is a Mac-only technology.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Ok-

We're at iOS11 - any Smartcard API yet?


And when you say there's no "public" API for interacting with smartcards are you inferring there's a private API?

We're at iOS11 - any Smartcard API yet?

No.

And when you say there's no "public" API for interacting with smartcards are you inferring there's a private API?

Honestly, I’ve no idea.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello,
With iOS13 SDK, CryptoTokenKit is now a Mac and iPhone technology. We can communicate with a smard card thanks to TKSmartCard. I would like to know if we absolutly need a smart card reader for iPhone or if the built-in SIM card reader can communicate with the SIM which is a smart Card?

I tried to use the TKSmartCardSlotManager on iOS13 but I have an error message:
SmartCard[3354:688268] [smartcard] ctk: connecting to slot registration server (<NSXPCConnection: 0x283c40bd0> connection to service on pid 0 named com.apple.ctkd.slot-client) failed, error Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.ctkd.slot-client was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.ctkd.slot-client was invalidated.}

Hi,


I would also like to send APDU commands to SIM card.

Is there any update on this post ?

@eskimo, can you please confirm if it is possible with iOS 13?


Thanks

I would also like to send APDU commands to SIM card.

There is not supported way to do this on iOS.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you very much for your response.


CryptoTokenKit with TKSmartCard is available since iOS 13.

Can we use this framework to access the sim card ? If not, what is the use on iOS?

Can we use this framework to access the sim card?

No.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"