PyObjC CryptoTokenKit Framework

12.1 · active · verified Tue Apr 14

PyObjC is a comprehensive bridge between Python and Objective-C, enabling the development of full-featured Cocoa applications entirely in Python. This specific package provides Python wrappers for Apple's CryptoTokenKit framework on macOS, allowing Python applications to interact with cryptographic tokens like smart cards and Hardware Security Modules (HSMs). The current version is 12.1, with releases typically aligning with macOS SDK updates and Python version support.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `CryptoTokenKit` framework and access one of its core classes, `TKTokenDriver`. While many classes in `CryptoTokenKit` are meant to be used within macOS app extensions for cryptographic token management, this snippet validates that the PyObjC bindings are correctly installed and accessible.

import CryptoTokenKit

# Accessing a class from the CryptoTokenKit framework
# Note: Instantiating many CryptoTokenKit classes directly in a script
# without being a proper macOS token extension might not be meaningful.
# This example primarily demonstrates successful import and class access.

token_driver_class = CryptoTokenKit.TKTokenDriver

print(f"Successfully imported CryptoTokenKit.")
print(f"TKTokenDriver is a: {type(token_driver_class)}")
print(f"Name of the TKTokenDriver class: {token_driver_class.__name__}")

# Example of attempting to access a class method (if available)
# (This specific call might not be functional without a running token service)
# if hasattr(token_driver_class, 'driverExtensionPointForIdentifier_'):
#     print(f"TKTokenDriver has driverExtensionPointForIdentifier_ method.")

view raw JSON →