Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinetrue


Getting OpenSCToken

OpenSCToken: Use OpenSC in CryptoTokenKit by Frank Morgner is a CryptoTokenKit plugin that works with OpenSC.

Fetch OpenSCToken-1.1.dmg, open the .dmg image, copy the application OpenSCTokenApp.app in your /Applications/ directory.
You need to start the OpenSCTokenApp application at least one time to register the CryptoTokenKit plugin provided by the application. The application does nothing and you can quit it now.

OpenSCToken Comparison with OpenSC.tokend

From the website project:

  • OpenSCToken supports multiple certificates, keys and PINs
  • OpenSCToken has proper support for PIN pad on reader or token
  • OpenSCToken offers easy login with smart card and automatically unlocks the login keychain
  • Tokens are not visible in Keychain Access any more (use sc_auth/security from command line instead)
  • Most non-Apple applications do not yet support CryptoTokenKit. If OpenSCToken is used together with OpenSC.tokend, your token will appear twice in Safari and other Apple-apps.

Check OpenSCToken installation

To check if the plugin is installed you can use the pluginkit command line tool.

...


This more verbose output allows you to know where on disk the plugin is found.
To remove/uninstall the plugin you just have to delete the application containing/providing the plugin.

List inserted token / Smart Cards

If your smart card is supported by one of the installed CryptoTokenKit plugin you will see it using the command "security list-smartcards".

Code Block
titleList inserted token / Smart Cards
$ security list-smartcards
org.opensc-project.mac.opensctoken.OpenSCTokenApp.OpenSCToken:3015061316010310

Displaying the Smart Card content

There is different ways to display the content of the card.

system_profiler SPSmartCardsDataType

Code Block
titlesystem_profiler SPSmartCardsDataType
collapsetrue
$ system_profiler SPSmartCardsDataType
SmartCards:

    Readers:

      #01: certgate AirID AID21918200007 via BLE (ATR:<3bd21802 ..... ......>)

    Reader Drivers:

      #01: org.debian.alioth.pcsclite.smartcardccid:1.4.27 (/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle)
      #02: com.certgate.macos.ifd-airid-ble:0.1.0 (/usr/local/libexec/SmartCardServices/drivers/ifd-airid-ble.bundle)
      #03: com.certgate.macos.airid.smartcardccid:1.4.30 (/usr/local/libexec/SmartCardServices/drivers/ifd-airid-ccid.bundle)

    Tokend Drivers:

      #01: com.apple.tokend.opensc:1.0 (/Library/Security/tokend/OpenSC.tokend)

    SmartCard Drivers:

      #01: org.opensc-project.mac.opensctoken.OpenSCTokenApp.OpenSCToken:1.1 (/Applications/OpenSCTokenApp.app/Contents/PlugIns/OpenSCToken.appex)
      #02: com.apple.CryptoTokenKit.pivtoken:1.0 (/System/Library/Frameworks/CryptoTokenKit.framework/PlugIns/pivtoken.appex)

    Available SmartCards (keychain):

        org.opensc-project.mac.opensctoken.OpenSCTokenApp.OpenSCToken:16910E24C8C6071028:

          #01: Kind: private RSA 2048-bit, Certificate: <20105e07 9019fdcc 8c1e4208 ded27e52 e327f56d>, Usage: Sign Decrypt Unwrap
Valid from: 2019-06-25 13:15:49 +0000 to: 2020-06-25 13:15:49 +0000, SSL trust: NO, X509 trust: YES

-----BEGIN CERTIFICATE-----
MIIGFzCCBP+gAwIBA .....
-----END CERTIFICATE-----


    Available SmartCards (token):

        org.opensc-project.mac.opensctoken.OpenSCTokenApp.OpenSCToken:16910E24C8C6071028:

          #01: Kind: private RSA 2048-bit, Certificate: <20105e07 9019fdcc 8c1e4208 ded27e52 e327f56d>, Usage: Sign Decrypt Unwrap
Valid from: 2019-06-25 13:15:49 +0000 to: 2020-06-25 13:15:49 +0000, SSL trust: NO, X509 trust: YES

-----BEGIN CERTIFICATE-----
MIIGFzCCBP+gAwIBA .....
-----END CERTIFICATE-----


Pairing an AirID via Bluetooth for the first time (BLE Pairing)

To be able to use an AirID device for the first time, it needs to be paired via macOS System Bluetooth. This process happens automatically after configuring the serial number for the AirID,  updating /etc/reader.conf  and rebooting the system.

...

After confirming by pushing the "Connection/Verbinden" Button it looks similar to 

Pairing a card to a user account (CTK Pairing)


After inserting the card you should see a dialog window like the one below.



Click on "Pair" to associate the card private key to the user account.

You will need to enter your account password:

...


Then enter the card PIN code:

And the user account again:

Finally the pairing of your certificate to your user account id is done

Using an untrusted Certification Authority

Note

Note that you can pair a card certificate to a user even if the certificate is not trusted. In my case the certificate is issued and signed by CAcert. This Certification Authority is not trusted by macOS (you can see that in the Keychain Access screen copy) but you can still use the untrusted certificate to login.

Check CTK pairing

You can now check that your account is paired to card

...


You will get the pairing dialog again after removing and inserting the card again. So it is easy to play with the pairing process.

CTK Pairing dialog status

Show Status of CTK pairing

You can display the status of the CTK pairing by issuing

Code Block
$ sc_auth pairing_ui -s status
SmartCard Pairing dialog is enabled.

Disable CTK pairing

If you click on the "Do not show again" on the pairing dialog box the dialog will not be displayed again.

...

Code Block
$ sc_auth pairing_ui -s disable
SmartCard Pairing dialog is disabled.

Enable CTK pairing

You can re-enable the pairing dialog using:

Code Block
$ sc_auth pairing_ui -s enable



Content by Label
showLabelsfalse
max5
spacesPM
showSpacefalse
sortmodified
reversetrue
typepage
excerptTypesimple
cqllabel in ("macos","macos-catalina","macos-mojave","ctk","cryptotokenkit") and type = "page" and space = "DEMTHSP"
labelskb-troubleshooting-article

Was this answer helpful?

Please rate & help us to improve our FAQ.

Rate Macro