AB Circle USB Demo

The AB Circle USB Demo Application is a Swift application demonstrating the use of communicating with AB Circle smart card readers using the Apple Smart Card Crypto Token Kit framework.

Supported Readers

  • CIR415
  • CIR515

OS Support

  • This demo application supports iOS 16 and iPadOS 16.1 or later.

Prerequisites

  1. A Mac computer
  2. An Apple Developer Account: https://developer.apple.com/programs/register/
  3. Xcode IDE - Xcode 11 or higher
  4. An iOS or ipadOS device - iPhone or iPad

Getting Started

  1. Open the project in Xcode 11 or higher
  2. Connect the iPhone or iPad to the Mac
  3. Select the iPhone or iPad as Target and press “Run” to start the demo on the device

Note: it is also possible to run the demo in a simulator also, but simulators do not have USB support available.

Demo Details

Main Screen

The Demo application consists of a main view holding controls to:

  1. Select a Card Terminal
  2. Connect to a Card on the Terminal
  3. Send APDU Commands to the connected Terminal

Notes:

  • Details and results are shown in a logger text view.


Usage

  1. Start the application, the main screen will open (with no terminals selected)
  2. Connect a CIR415/CIR515 reader through the USB port and press the ‘Refresh’ button on the main screen
  3. If a CIR415/CIR515 reader has been found, the selected terminal field will show its name
  4. Press the selected terminal field to open a terminal selection view in order to select another terminal if needed
  5. Choose the connection method (exclusive or direct) and the connection protocol (T=0, T=1 or both)
  6. Place a card on the CIR415 reader (or insert a card in the CIR515 reader) and press'Connect’ to connect to the card using above-mentioned settings
  7. Press ‘Send’ to send the default APDU or tap the APDU field to enter another APDU first

Notes:

  • Apdu command field will only enabled after connecting to a terminal / card.
  • Connection protocol selection at this time is ignored.


Demo Contents

The following files are shown in the demo project:

  • Main.storyboard : Holds the main views used in the demo
  • ViewController.Swift: Main class controlling the main view and using the ABCSmartCardIO framework functionality
  • TextInputViewController.Swift: Class controlling the APDU / Escape command input view
  • NoCaretUITextField.Swift: Custom read only UITextField control (used for APDU / Escape Command input fields)
  • NoCaretUITextView.Swift: Custom read only UITextView control (used for the log view)
  • HexEditUITextView.Swift: Custom UITextView control enabling hexadecimal input (used for APDU / Escape Command input)
  • ToolbarUIPickerView.Swift: Custom UIPickerView with toolbar (used for terminal selection)
  • Helper.Swift: Class holding some helper functions
  • ABCTKSmartCard.Swift: Helper class for enabling Crypto Token Kit functionality to an application
  • project.entitlements: entitlement file holding the smartcard entitlement.
  • Info.plist: application information property list
  • Assets.sxassets: defines the icons used in this demo

Notes:

  • For details on above classes, see also the documentation in the Documentation folder.
  • Other files are auto-generated files when the project was created and should not be modified

(USB) Smart Card Access Rights for applications

In order for applications to use smart cards, access needs to be enabled by adding an entitlement called com.apple.security.smartcard into an entitlement file (added to this project already).

More info on this here: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_smartcard

History

v1.0.0 14 February 2025

  • Initial release

Authors

License

Copyright (c) 2018-2025, AB Circle Ltd. All rights reserved.