cryptotokenkit

package
v0.6.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package cryptotokenkit provides Go bindings for the CryptoTokenKit framework.

Access security tokens and the cryptographic assets they store.

You use the CryptoTokenKit framework to easily access cryptographic tokens. Tokens are physical devices built in to the system, located on attached hardware (like a smart card), or accessible through a network connection. Tokens store cryptographic objects like keys and certificates. They also may perform operations—for example, encryption or digital signature verification—using these objects. You use the framework to work with a token’s assets as if they were part of your system, even though they remain secured by the token.

Smart Cards

Smart Card App Extensions

Tokens

Errors

Classes

Key Types

Code generated from Apple documentation. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TKErrorDomain is the domain for all CryptoTokenKit framework errors.
	//
	// See: https://developer.apple.com/documentation/CryptoTokenKit/TKErrorDomain
	TKErrorDomain string
)

Functions

func NewBoolErrorBlock

func NewBoolErrorBlock(handler BoolErrorHandler) (objc.ID, func())

NewBoolErrorBlock wraps a Go BoolErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

func NewDataErrorBlock

func NewDataErrorBlock(handler DataErrorHandler) (objc.ID, func())

NewDataErrorBlock wraps a Go DataErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

func NewIntVoidBlock

func NewIntVoidBlock(handler IntVoidHandler) (objc.ID, func())

NewIntVoidBlock wraps a Go IntVoidHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

func NewStringBlock

func NewStringBlock(handler StringHandler) (objc.ID, func())

NewStringBlock wraps a Go StringHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

func NewTKSmartCardSlotBlock

func NewTKSmartCardSlotBlock(handler TKSmartCardSlotHandler) (objc.ID, func())

NewTKSmartCardSlotBlock wraps a Go TKSmartCardSlotHandler as an Objective-C block. The caller must defer the returned cleanup function.

Used by:

Types

type BoolErrorHandler

type BoolErrorHandler = func(bool, error)

BoolErrorHandler handles success: Whether the session could be established successfully.

  • success: Whether the session could be established successfully.
  • error: Contains information about the error preventing the transaction from being established.

The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.

Used by:

type DataErrorHandler

type DataErrorHandler = func(*foundation.NSData, error)

DataErrorHandler handles response: The APDU response data, or `nil` if communication with the Smart Card failed.

  • response: The APDU response data, or `nil` if communication with the Smart Card failed.
  • error: Contains information about the the error preventing the transaction from being established.

The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.

Used by:

type ITKBERTLVRecord

type ITKBERTLVRecord interface {
	ITKTLVRecord

	// Initializes a BER-TLV record with the specified tag and value.
	InitWithTagValue(tag TKTLVTag, value foundation.NSData) TKBERTLVRecord
	// Initializes a BER-TLV record with the specified tag and an array of TLV subrecords.
	InitWithTagRecords(tag TKTLVTag, records []TKTLVRecord) TKBERTLVRecord
}

An interface definition for the TKBERTLVRecord class.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord

type ITKCompactTLVRecord

type ITKCompactTLVRecord interface {
	ITKTLVRecord

	// Initializes a TLV record with the specified tag and value.
	InitWithTagValue(tag uint8, value foundation.NSData) TKCompactTLVRecord
}

An interface definition for the TKCompactTLVRecord class.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKCompactTLVRecord

type ITKSimpleTLVRecord

type ITKSimpleTLVRecord interface {
	ITKTLVRecord

	// Initializes a TLV record with the specified tag and value.
	InitWithTagValue(tag uint8, value foundation.NSData) TKSimpleTLVRecord
}

An interface definition for the TKSimpleTLVRecord class.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSimpleTLVRecord

type ITKSmartCard

type ITKSmartCard interface {
	objectivec.IObject

	// The slot in which the Smart Card is inserted.
	Slot() ITKSmartCardSlot
	// Whether the Smart Card is valid and accessible from its slot.
	Valid() bool
	// Whether sessions established for the Smart Card should be considered sensitive. [false](<https://developer.apple.com/documentation/Swift/false>) by default.
	Sensitive() bool
	SetSensitive(value bool)
	// User-specified information. This property is automatically set to `nil` if the Smart Card is removed or another [TKSmartCard] object begins a session.
	Context() objectivec.IObject
	SetContext(value objectivec.IObject)

	// The protocols allowed for communication with the Smart Card. [any](<https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardProtocol/any>) by default.
	AllowedProtocols() TKSmartCardProtocol
	SetAllowedProtocols(value TKSmartCardProtocol)
	// The protocol used for communication with the Smart Card. Returns [TKSmartCardProtocolNone](<https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardProtocol/TKSmartCardProtocolNone>) if no session is currently established.
	CurrentProtocol() TKSmartCardProtocol

	// Begins a session with the Smart Card.
	BeginSessionWithReply(reply BoolErrorHandler)
	// Transmits data in Application Protocol Data Unit (APDU) format to the Smart Card.
	TransmitRequestReply(request foundation.NSData, reply DataErrorHandler)
	// Completes any pending transmissions and ends the session to the Smart Card.
	EndSession()

	// Creates and returns a new user interaction object for secure PIN verification using the Smart Card reader facilities.
	UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset(PINFormat ITKSmartCardPINFormat, APDU foundation.NSData, PINByteOffset int) ITKSmartCardUserInteractionForSecurePINVerification
	// Creates a new user interaction object for secure PIN change using the smart card reader facilities (typically a HW keypad).
	UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset(PINFormat ITKSmartCardPINFormat, APDU foundation.NSData, currentPINByteOffset int, newPINByteOffset int) ITKSmartCardUserInteractionForSecurePINChange

	// The CLA byte used for APDU transmission. `0x00` by default.
	Cla() uint8
	SetCla(value uint8)
	// Whether to use extended length APDU.
	UseExtendedLength() bool
	SetUseExtendedLength(value bool)
	// Whether to use command chaining of APDU with a data field longer than 255 bytes.
	UseCommandChaining() bool
	SetUseCommandChaining(value bool)
}

An interface definition for the TKSmartCard class.

Configuring the Smart Card

Setting the Communication Protocol

Communicating with the Smart Card

Managing User Interaction

Configuring APDU Behavior

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard

type ITKSmartCardATR

type ITKSmartCardATR interface {
	objectivec.IObject

	// Initializes a [TKSmartCardATR] object from a provided data object.
	InitWithBytes(bytes foundation.NSData) TKSmartCardATR
	// Initializes a [TKSmartCardATR] object from a provided data source.
	InitWithSource(source IntVoidHandler) TKSmartCardATR

	// An array of protocols indicated in the ATR
	Protocols() []foundation.NSNumber
	// The ATR message data.
	Bytes() foundation.NSData
	// The ATR historical bytes, not including interface bytes or the TCK (check byte).
	HistoricalBytes() foundation.NSData
	// A list of compact TLV records parsed from historical bytes.
	HistoricalRecords() []TKCompactTLVRecord

	// Returns the interface group at the specified index.
	InterfaceGroupAtIndex(index int) ITKSmartCardATRInterfaceGroup
	// Returns the interface group with the specified protocol.
	InterfaceGroupForProtocol(protocol_ TKSmartCardProtocol) ITKSmartCardATRInterfaceGroup
}

An interface definition for the TKSmartCardATR class.

Creating a Smart Card ATR

Accessing ATR Attributes

Retrieving Interface Groups

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR

type ITKSmartCardATRInterfaceGroup

type ITKSmartCardATRInterfaceGroup interface {
	objectivec.IObject

	// The protocol for this group.
	Protocol() foundation.NSNumber
	// The TA interface byte of ATR group, or `nil` if TA is not present.
	TA() foundation.NSNumber
	// The TB interface byte of ATR group, or `nil` if TB is not present.
	TB() foundation.NSNumber
	// The TC interface byte of ATR group, or `nil` if TC is not present.
	TC() foundation.NSNumber
}

An interface definition for the TKSmartCardATRInterfaceGroup class.

Accessing Interface Group Protocol and Bytes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup

type ITKSmartCardPINFormat

type ITKSmartCardPINFormat interface {
	objectivec.IObject

	// The format of PIN characters. [TKSmartCardPINCharsetNumeric] by default.
	Charset() TKSmartCardPINCharset
	SetCharset(value TKSmartCardPINCharset)
	// The encoding of PIN characters. [TKSmartCardPINEncodingASCII] by default.
	Encoding() TKSmartCardPINEncoding
	SetEncoding(value TKSmartCardPINEncoding)
	// The minimum number of characters to form a valid PIN. `4` by default.
	MinPINLength() int
	SetMinPINLength(value int)
	// The maximum number of characters to form a valid PIN. `8` by default.
	MaxPINLength() int
	SetMaxPINLength(value int)
	// The total length of the PIN block in bytes. `8` by default.
	PINBlockByteLength() int
	SetPINBlockByteLength(value int)
	// The justification within the PIN block. [TKSmartCardPINJustificationLeft] by default.
	PINJustification() TKSmartCardPINJustification
	SetPINJustification(value TKSmartCardPINJustification)
	// The offset, in bits, within the PIN block to mark a location for filling in the formatted PIN, which is justified with respect to the [pinJustification](<https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/pinJustification>) property value. `0` by default.
	PINBitOffset() int
	SetPINBitOffset(value int)
	// The offset, in bits, within the PIN block to mark a location for filling in the PIN length, which is always left justified. `0` by default.
	PINLengthBitOffset() int
	SetPINLengthBitOffset(value int)
	// The size, in bits, of the PIN length field. If set to `0`, PIN length is not written. `0` by default.
	PINLengthBitSize() int
	SetPINLengthBitSize(value int)
}

An interface definition for the TKSmartCardPINFormat class.

Configuring PIN Formatting

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat

type ITKSmartCardSlot

type ITKSmartCardSlot interface {
	objectivec.IObject

	// Creates a new [TKSmartCard](<https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard>) object representing the currently inserted Smart Card.
	MakeSmartCard() ITKSmartCard

	// The current state of the Smart Card reader slot.
	State() TKSmartCardSlotState

	// The name of the Smart Card reader slot.
	Name() string
	// The maximum length of input APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer to the Smart Card.
	MaxInputLength() int
	// The maximum length of output APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer from the Smart Card.
	MaxOutputLength() int

	// The ATR (Answer to Reset) of the inserted Smart Card, or `nil` if no Smart Card is inserted or the inserted Smart Card is mute.
	ATR() ITKSmartCardATR
}

An interface definition for the TKSmartCardSlot class.

Instantiating Smart Cards

Getting the Slot State

Getting the Slot Configuration

Reading the Answer to Reset

  • ITKSmartCardSlot.ATR: The ATR (Answer to Reset) of the inserted Smart Card, or `nil` if no Smart Card is inserted or the inserted Smart Card is mute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot

type ITKSmartCardSlotManager

type ITKSmartCardSlotManager interface {
	objectivec.IObject

	// A list of identifiers for all the Smart Card reader slots available to the system.
	SlotNames() []string
	// Asynchronously calls a block with a Smart Card reader slot for a specified name.
	GetSlotWithNameReply(name string, reply TKSmartCardSlotHandler)
	// Returns the Smart Card slot with a given name.
	SlotNamed(name string) ITKSmartCardSlot
}

An interface definition for the TKSmartCardSlotManager class.

Accessing Smart Card Slots

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager

type ITKSmartCardToken

type ITKSmartCardToken interface {
	ITKToken

	// Initializes a smart card token with the specified smart card, application identifier, and token driver.
	InitWithSmartCardAIDInstanceIDTokenDriver(smartCard ITKSmartCard, AID foundation.NSData, instanceID string, tokenDriver ITKSmartCardTokenDriver) TKSmartCardToken

	// The ISO 7816-4 application identifiers of the Smart Card.
	AID() foundation.NSData
}

An interface definition for the TKSmartCardToken class.

Creating Smart Card Tokens

Accessing the Application Identifier

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardToken

type ITKSmartCardTokenDriver

type ITKSmartCardTokenDriver interface {
	ITKTokenDriver
}

An interface definition for the TKSmartCardTokenDriver class.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenDriver

type ITKSmartCardTokenSession

type ITKSmartCardTokenSession interface {
	ITKTokenSession

	// The smart card for the active exclusive session and selected application.
	SmartCard() ITKSmartCard

	GetSmartCardWithError() (ITKSmartCard, error)
}

An interface definition for the TKSmartCardTokenSession class.

Accessing the Smart Card

Instance Methods

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenSession

type ITKSmartCardUserInteraction

type ITKSmartCardUserInteraction interface {
	objectivec.IObject

	// The delegate for observing events that occur during the user interaction.
	Delegate() TKSmartCardUserInteractionDelegate
	SetDelegate(value TKSmartCardUserInteractionDelegate)

	// The timeout, in seconds, for initial interaction. If set to `0`, the reader-defined default timeout is used. `0` by default.
	InitialTimeout() foundation.NSTimeInterval
	SetInitialTimeout(value foundation.NSTimeInterval)
	// The timeout, in seconds, after the first key stroke. If set to `0`, the reader-defined default timeout is used. `0` by default.
	InteractionTimeout() foundation.NSTimeInterval
	SetInteractionTimeout(value foundation.NSTimeInterval)

	// Runs the user interaction and asynchronously receives a reply.
	RunWithReply(reply BoolErrorHandler)
	// Attempts to cancel an interaction started by calling [run(reply:)](<https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/run(reply:)>). For certain interactions, cancellation may not be available.
	Cancel() bool
}

An interface definition for the TKSmartCardUserInteraction class.

Handling User Interaction Events

Configuring Timeout

Starting and Stopping

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction

type ITKSmartCardUserInteractionForPINOperation

type ITKSmartCardUserInteractionForPINOperation interface {
	ITKSmartCardUserInteraction

	// The conditions under which PIN entry should be considered complete.
	PINCompletion() TKSmartCardPINCompletion
	SetPINCompletion(value TKSmartCardPINCompletion)

	// A list of message indices referring to a predefined message table, used to specify the type and number of messages displayed during the PIN operation. `nil` by default.
	PINMessageIndices() []foundation.NSNumber
	SetPINMessageIndices(value []foundation.NSNumber)
	// The locale for the displayed messages. If `nil`, the user’s current locale is used. By default, this value is the current locale of the system.
	Locale() foundation.NSLocale
	SetLocale(value foundation.NSLocale)

	// The SW1-SW2 status bytes.
	ResultSW() uint16
	SetResultSW(value uint16)
	// The returned data without SW1-SW2 bytes, if any.
	ResultData() foundation.NSData
	SetResultData(value foundation.NSData)
}

An interface definition for the TKSmartCardUserInteractionForPINOperation class.

Managing Pin Completion

Configuring Messages

Accessing Response Data

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation

type ITKSmartCardUserInteractionForSecurePINChange

type ITKSmartCardUserInteractionForSecurePINChange interface {
	ITKSmartCardUserInteractionForPINOperation

	// The way PIN confirmation is requested. [TKSmartCardPINConfirmationNone] by default.
	PINConfirmation() TKSmartCardPINConfirmation
	SetPINConfirmation(value TKSmartCardPINConfirmation)
}

An interface definition for the TKSmartCardUserInteractionForSecurePINChange class.

Configuring User Interaction

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForSecurePINChange

type ITKTLVRecord

type ITKTLVRecord interface {
	objectivec.IObject

	// The tag field of the record.
	Tag() TKTLVTag

	// The value field of the record.
	Value() foundation.NSData

	// The record data, including the tag, length, and value fields.
	Data() foundation.NSData
}

An interface definition for the TKTLVRecord class.

Accessing the Tag Field

Accessing the Value Field

Accessing Record Data

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord

type ITKToken

type ITKToken interface {
	objectivec.IObject

	// Initializes a token with the driver you specify.
	InitWithTokenDriverInstanceID(tokenDriver ITKTokenDriver, instanceID TKTokenInstanceID) TKToken

	// The token delegate.
	Delegate() TKTokenDelegate
	SetDelegate(value TKTokenDelegate)

	// The token driver.
	TokenDriver() ITKTokenDriver

	// The contents of the keychain for this token.
	KeychainContents() ITKTokenKeychainContents

	// The current configuration for a token.
	Configuration() ITKTokenConfiguration
}

An interface definition for the TKToken class.

Creating Tokens

Responding to Session Creation

Accessing the Driver

Accessing Keychain Items

Configuring the Token

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken

type ITKTokenAuthOperation

type ITKTokenAuthOperation interface {
	objectivec.IObject

	// Finishes the authentication operation.
	FinishWithError() (bool, error)

	EncodeWithCoder(coder foundation.INSCoder)
}

An interface definition for the TKTokenAuthOperation class.

Finishing the Operation

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenAuthOperation

type ITKTokenConfiguration

type ITKTokenConfiguration interface {
	objectivec.IObject

	// The unique, persistent identifier of this token that the token implementation creates.
	InstanceID() TKTokenInstanceID
	// Additional configuration information for the token instance.
	ConfigurationData() foundation.NSData
	SetConfigurationData(value foundation.NSData)

	// The keychain items associated with this token.
	KeychainItems() []TKTokenKeychainItem
	SetKeychainItems(value []TKTokenKeychainItem)
	// Returns a certificate from the keychain with the object identifier you specify.
	CertificateForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainCertificate, error)
	// Returns a key from the keychain with the object identifier you specify.
	KeyForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainKey, error)
}

An interface definition for the TKTokenConfiguration class.

Reporting Configuration Information

Retrieving Keys and Certificates

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class

type ITKTokenDriver

type ITKTokenDriver interface {
	objectivec.IObject

	// The token driver delegate.
	Delegate() TKTokenDriverDelegate
	SetDelegate(value TKTokenDriverDelegate)
}

An interface definition for the TKTokenDriver class.

Responding to Token Creation

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver

type ITKTokenDriverConfiguration

type ITKTokenDriverConfiguration interface {
	objectivec.IObject

	// The class identifier of the token driver.
	ClassID() TKTokenDriverClassID
	// A dictionary of all currently configured tokens for this token class, which the token instance identifier keys.
	TokenConfigurations() foundation.INSDictionary

	// Creates a configuration object for a token with the token instance identifier you specify.
	AddTokenConfigurationForTokenInstanceID(instanceID TKTokenInstanceID) ITKTokenConfiguration
	// Removes a configuration for a token with the token instance identifier you specify.
	RemoveTokenConfigurationForTokenInstanceID(instanceID TKTokenInstanceID)
}

An interface definition for the TKTokenDriverConfiguration class.

Reporting Configuration Information

Adding and Removing Configurations

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration

type ITKTokenKeyAlgorithm

type ITKTokenKeyAlgorithm interface {
	objectivec.IObject

	// Returns whether the specified algorithm is the target operation algorithm.
	IsAlgorithm(algorithm corefoundation.CFStringRef) bool
	// Whether the specified algorithm is the target operation algorithm, or one of the other algorithms used.
	SupportsAlgorithm(algorithm corefoundation.CFStringRef) bool
}

An interface definition for the TKTokenKeyAlgorithm class.

Determining Algorithm Usage

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyAlgorithm

type ITKTokenKeyExchangeParameters

type ITKTokenKeyExchangeParameters interface {
	objectivec.IObject

	// Returns the requested output size, in bytes, of key exchange result.
	RequestedSize() int
	// Returns shared information typically used during the key derivation (KDF) step of a key exchange algorithm.
	SharedInfo() foundation.NSData
}

An interface definition for the TKTokenKeyExchangeParameters class.

Accessing Parameters

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyExchangeParameters

type ITKTokenKeychainCertificate

type ITKTokenKeychainCertificate interface {
	ITKTokenKeychainItem

	// Initializes a token keychain certificate with data from the specified certificate reference and a given object ID.
	InitWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainCertificate

	// Returns a DER-encoded representation of an X.509 certificate.
	Data() foundation.NSData
}

An interface definition for the TKTokenKeychainCertificate class.

Creating Token Keychain Certificates

Accessing Certificate Data

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainCertificate

type ITKTokenKeychainContents

type ITKTokenKeychainContents interface {
	objectivec.IObject

	// Fills the keychain with the specified items.
	FillWithItems(items []TKTokenKeychainItem)

	// Returns all items for token in the keychain.
	Items() []TKTokenKeychainItem
	// Returns the key for a specified object identifier.
	KeyForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainKey, error)
	// Returns the key for a specified object identifier.
	CertificateForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainCertificate, error)
}

An interface definition for the TKTokenKeychainContents class.

Adding Keychain Items

Accessing Keychain Items

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents

type ITKTokenKeychainItem

type ITKTokenKeychainItem interface {
	objectivec.IObject

	// Initializes a token keychain item with the specified object ID.
	InitWithObjectID(objectID TKTokenObjectID) TKTokenKeychainItem

	// Returns the object ID used for keychain item identification.
	ObjectID() TKTokenObjectID
	// The user-visible label for the keychain item.
	Label() string
	SetLabel(value string)
	// Access constraints for the keychain item, keyed by [TKTokenOperation](<https://developer.apple.com/documentation/CryptoTokenKit/TKTokenOperation>) values wrapped in [NSNumber](<https://developer.apple.com/documentation/Foundation/NSNumber>) objects.
	Constraints() foundation.INSDictionary
	SetConstraints(value foundation.INSDictionary)
}

An interface definition for the TKTokenKeychainItem class.

Creating Token Keychain Items

Accessing Keychain Item Attributes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem

type ITKTokenKeychainKey

type ITKTokenKeychainKey interface {
	ITKTokenKeychainItem

	// Initializes a token keychain key with data from the specified certificate reference and a given object ID.
	InitWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainKey

	// The type of the key. Currently, only [kSecAttrKeyTypeRSA](<https://developer.apple.com/documentation/Security/kSecAttrKeyTypeRSA>) and `kSecAttrKeyTypeECSECPrimeRandom` are supported values.
	KeyType() string
	SetKeyType(value string)
	KeySizeInBits() int
	SetKeySizeInBits(value int)
	// The private tag data.
	ApplicationTag() foundation.NSData
	SetApplicationTag(value foundation.NSData)
	// The public key data.
	PublicKeyData() foundation.NSData
	SetPublicKeyData(value foundation.NSData)
	// The SHA1 hash of the raw public key.
	PublicKeyHash() foundation.NSData
	SetPublicKeyHash(value foundation.NSData)
	// Whether the key can be used to decrypt data.
	CanDecrypt() bool
	SetCanDecrypt(value bool)
	// Whether the key can be used to sign data.
	CanSign() bool
	SetCanSign(value bool)
	// Whether the key can be used to perform Diffie-Hellman style cryptographic key exchange.
	CanPerformKeyExchange() bool
	SetCanPerformKeyExchange(value bool)
	// Whether the key can be used for system login.
	IsSuitableForLogin() bool
	SetSuitableForLogin(value bool)
}

An interface definition for the TKTokenKeychainKey class.

Creating Token Keychain Keys

Accessing Key Attributes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey

type ITKTokenPasswordAuthOperation

type ITKTokenPasswordAuthOperation interface {
	ITKTokenAuthOperation

	// The password to be filled in when the “ is called.
	Password() string
	SetPassword(value string)
}

An interface definition for the TKTokenPasswordAuthOperation class.

Managing the Password

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenPasswordAuthOperation

type ITKTokenSession

type ITKTokenSession interface {
	objectivec.IObject

	// Initializes a token session with the specified token.
	InitWithToken(token ITKToken) TKTokenSession

	// The token session delegate.
	Delegate() TKTokenSessionDelegate
	SetDelegate(value TKTokenSessionDelegate)

	// The token to which the session is bound.
	Token() ITKToken
}

An interface definition for the TKTokenSession class.

Creating Token Sessions

Responding to Authentication Events

Accessing the Token

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession

type ITKTokenSmartCardPINAuthOperation

type ITKTokenSmartCardPINAuthOperation interface {
	ITKTokenAuthOperation

	// The PIN format.
	PINFormat() ITKSmartCardPINFormat
	SetPINFormat(value ITKSmartCardPINFormat)
	// The template into which the PIN is filled in. `nil` by default.
	APDUTemplate() foundation.NSData
	SetAPDUTemplate(value foundation.NSData)
	// The offset, in bytes, within the APDU template to mark the location for filling in the PIN.
	PINByteOffset() int
	SetPINByteOffset(value int)
	// A Smart Card to which the formatted APDU is sent in order to authenticate.
	SmartCard() ITKSmartCard
	SetSmartCard(value ITKSmartCard)

	// The PIN value resulting from performing the operation.
	PIN() string
	SetPIN(value string)
}

An interface definition for the TKTokenSmartCardPINAuthOperation class.

Configuring the Operation

Accessing the PIN

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation

type ITKTokenWatcher

type ITKTokenWatcher interface {
	objectivec.IObject

	// The token IDs currently available in the system.
	TokenIDs() []string

	// Adds a removal handler for the specified token ID.
	AddRemovalHandlerForTokenID(removalHandler StringHandler, tokenID string)
	// Sets an insertion handler closure to be called when a new token is inserted into the system.
	SetInsertionHandler(insertionHandler StringHandler)

	TokenInfoForTokenID(tokenID string) ITKTokenWatcherTokenInfo
}

An interface definition for the TKTokenWatcher class.

Accessing Token Identifiers

Configuring Handlers

Instance Methods

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher

type IntVoidHandler

type IntVoidHandler = func() int

IntVoidHandler handles The block providing a stream of data for an ATR.

Used by:

type StringHandler

type StringHandler = func(*string)

StringHandler handles A block to be called when the specified token is removed.

  • tokenID: The identifier of the removed token.

Used by:

type TKBERTLVRecord

type TKBERTLVRecord struct {
	TKTLVRecord
}

An object that parses BER-encoded data and produces DER-encoded data for TLV records.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord

func NewTKBERTLVRecord

func NewTKBERTLVRecord() TKBERTLVRecord

NewTKBERTLVRecord creates a new TKBERTLVRecord instance.

func NewTKBERTLVRecordFromData

func NewTKBERTLVRecordFromData(data foundation.NSData) TKBERTLVRecord

Creates and returns a TLV record from by parsing the specified data.

data: A data object containing the serialized representation of a TLV record.

Return Value

A TLV record, or `nil` if `data` does not specify a valid record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/init(from:)

func NewTKBERTLVRecordWithTagRecords

func NewTKBERTLVRecordWithTagRecords(tag TKTLVTag, records []TKTLVRecord) TKBERTLVRecord

Initializes a BER-TLV record with the specified tag and an array of TLV subrecords.

tag: The tag field of the record.

records: The TLV subrecords of the record.

Return Value

A new TLV record containing the specified tag field and subrecords.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord/init(tag:records:)

func NewTKBERTLVRecordWithTagValue

func NewTKBERTLVRecordWithTagValue(tag TKTLVTag, value foundation.NSData) TKBERTLVRecord

Initializes a BER-TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord/init(tag:value:)

func TKBERTLVRecordFromID

func TKBERTLVRecordFromID(id objc.ID) TKBERTLVRecord

TKBERTLVRecordFromID constructs a TKBERTLVRecord from an objc.ID.

An object that parses BER-encoded data and produces DER-encoded data for TLV records.

func (TKBERTLVRecord) Autorelease

func (t TKBERTLVRecord) Autorelease() TKBERTLVRecord

Autorelease adds the receiver to the current autorelease pool.

func (TKBERTLVRecord) Init

func (t TKBERTLVRecord) Init() TKBERTLVRecord

Init initializes the instance.

func (TKBERTLVRecord) InitWithTagRecords

func (t TKBERTLVRecord) InitWithTagRecords(tag TKTLVTag, records []TKTLVRecord) TKBERTLVRecord

Initializes a BER-TLV record with the specified tag and an array of TLV subrecords.

tag: The tag field of the record.

records: The TLV subrecords of the record.

Return Value

A new TLV record containing the specified tag field and subrecords.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord/init(tag:records:)

func (TKBERTLVRecord) InitWithTagValue

func (t TKBERTLVRecord) InitWithTagValue(tag TKTLVTag, value foundation.NSData) TKBERTLVRecord

Initializes a BER-TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord/init(tag:value:)

type TKBERTLVRecordClass

type TKBERTLVRecordClass struct {
	// contains filtered or unexported fields
}

func GetTKBERTLVRecordClass

func GetTKBERTLVRecordClass() TKBERTLVRecordClass

GetTKBERTLVRecordClass returns the class object for TKBERTLVRecord.

func (TKBERTLVRecordClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKBERTLVRecordClass) Class

func (tc TKBERTLVRecordClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

func (TKBERTLVRecordClass) DataForTag

func (_TKBERTLVRecordClass TKBERTLVRecordClass) DataForTag(tag TKTLVTag) foundation.NSData

Encodes a specified tag using BER-TLV tag encoding rules.

tag: The tag value to encode.

Return Value

A data object that encodes a tag value using BER-TLV encoding.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKBERTLVRecord/data(forTag:)

type TKCompactTLVRecord

type TKCompactTLVRecord struct {
	TKTLVRecord
}

An object that implements encoding using Compact-TLV encoding according to ISO 7816-4.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKCompactTLVRecord

func NewTKCompactTLVRecord

func NewTKCompactTLVRecord() TKCompactTLVRecord

NewTKCompactTLVRecord creates a new TKCompactTLVRecord instance.

func NewTKCompactTLVRecordFromData

func NewTKCompactTLVRecordFromData(data foundation.NSData) TKCompactTLVRecord

Creates and returns a TLV record from by parsing the specified data.

data: A data object containing the serialized representation of a TLV record.

Return Value

A TLV record, or `nil` if `data` does not specify a valid record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/init(from:)

func NewTKCompactTLVRecordWithTagValue

func NewTKCompactTLVRecordWithTagValue(tag uint8, value foundation.NSData) TKCompactTLVRecord

Initializes a TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKCompactTLVRecord/init(tag:value:)

func TKCompactTLVRecordFromID

func TKCompactTLVRecordFromID(id objc.ID) TKCompactTLVRecord

TKCompactTLVRecordFromID constructs a TKCompactTLVRecord from an objc.ID.

An object that implements encoding using Compact-TLV encoding according to ISO 7816-4.

func (TKCompactTLVRecord) Autorelease

func (t TKCompactTLVRecord) Autorelease() TKCompactTLVRecord

Autorelease adds the receiver to the current autorelease pool.

func (TKCompactTLVRecord) Init

Init initializes the instance.

func (TKCompactTLVRecord) InitWithTagValue

func (t TKCompactTLVRecord) InitWithTagValue(tag uint8, value foundation.NSData) TKCompactTLVRecord

Initializes a TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKCompactTLVRecord/init(tag:value:)

type TKCompactTLVRecordClass

type TKCompactTLVRecordClass struct {
	// contains filtered or unexported fields
}

func GetTKCompactTLVRecordClass

func GetTKCompactTLVRecordClass() TKCompactTLVRecordClass

GetTKCompactTLVRecordClass returns the class object for TKCompactTLVRecord.

func (TKCompactTLVRecordClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKCompactTLVRecordClass) Class

func (tc TKCompactTLVRecordClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKErrorCode

type TKErrorCode int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKError/Code

const (
	TKErrorAuthenticationFailed TKErrorCode = -5
	// TKErrorCodeAuthenticationFailed: Authentication failed.
	TKErrorCodeAuthenticationFailed TKErrorCode = -5
	// TKErrorCodeAuthenticationNeeded: Authentication is needed.
	TKErrorCodeAuthenticationNeeded TKErrorCode = -9
	// TKErrorCodeBadParameter: An invalid parameter was provided.
	TKErrorCodeBadParameter TKErrorCode = -8
	// TKErrorCodeCanceledByUser: The operation was canceled by the user.
	TKErrorCodeCanceledByUser TKErrorCode = -4
	// TKErrorCodeCommunicationError: A communication error occurred.
	TKErrorCodeCommunicationError TKErrorCode = -2
	// TKErrorCodeCorruptedData: The data was corrupted.
	TKErrorCodeCorruptedData TKErrorCode = -3
	// TKErrorCodeNotImplemented: The functionality is not implemented.
	TKErrorCodeNotImplemented TKErrorCode = -1
	// TKErrorCodeObjectNotFound: The object was not found.
	TKErrorCodeObjectNotFound TKErrorCode = -6
	// TKErrorCodeTokenNotFound: The token was not found.
	TKErrorCodeTokenNotFound TKErrorCode = -7
	TKErrorObjectNotFound    TKErrorCode = -6
	TKErrorTokenNotFound     TKErrorCode = -7
)

func (TKErrorCode) String

func (e TKErrorCode) String() string

type TKSimpleTLVRecord

type TKSimpleTLVRecord struct {
	TKTLVRecord
}

An object that implements encoding using Simple-TLV encoding according to ISO 7816-4.

Creating TLV Records

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSimpleTLVRecord

func NewTKSimpleTLVRecord

func NewTKSimpleTLVRecord() TKSimpleTLVRecord

NewTKSimpleTLVRecord creates a new TKSimpleTLVRecord instance.

func NewTKSimpleTLVRecordFromData

func NewTKSimpleTLVRecordFromData(data foundation.NSData) TKSimpleTLVRecord

Creates and returns a TLV record from by parsing the specified data.

data: A data object containing the serialized representation of a TLV record.

Return Value

A TLV record, or `nil` if `data` does not specify a valid record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/init(from:)

func NewTKSimpleTLVRecordWithTagValue

func NewTKSimpleTLVRecordWithTagValue(tag uint8, value foundation.NSData) TKSimpleTLVRecord

Initializes a TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSimpleTLVRecord/init(tag:value:)

func TKSimpleTLVRecordFromID

func TKSimpleTLVRecordFromID(id objc.ID) TKSimpleTLVRecord

TKSimpleTLVRecordFromID constructs a TKSimpleTLVRecord from an objc.ID.

An object that implements encoding using Simple-TLV encoding according to ISO 7816-4.

func (TKSimpleTLVRecord) Autorelease

func (t TKSimpleTLVRecord) Autorelease() TKSimpleTLVRecord

Autorelease adds the receiver to the current autorelease pool.

func (TKSimpleTLVRecord) Init

Init initializes the instance.

func (TKSimpleTLVRecord) InitWithTagValue

func (t TKSimpleTLVRecord) InitWithTagValue(tag uint8, value foundation.NSData) TKSimpleTLVRecord

Initializes a TLV record with the specified tag and value.

tag: The tag field of the record.

value: The value field of the record.

Return Value

A new TLV record containing the specified tag and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSimpleTLVRecord/init(tag:value:)

type TKSimpleTLVRecordClass

type TKSimpleTLVRecordClass struct {
	// contains filtered or unexported fields
}

func GetTKSimpleTLVRecordClass

func GetTKSimpleTLVRecordClass() TKSimpleTLVRecordClass

GetTKSimpleTLVRecordClass returns the class object for TKSimpleTLVRecord.

func (TKSimpleTLVRecordClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSimpleTLVRecordClass) Class

func (tc TKSimpleTLVRecordClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKSmartCard

type TKSmartCard struct {
	objectivec.Object
}

A representation of a smart card.

Overview

This class provides an interface for managing sessions with a smart card, transmitting requests, and facilitating user interaction.

You can create a TKSmartCard object when a smart card is inserted into a slot, by calling the [TKSmartCardSlot.SmartCard] method on the corresponding TKSmartCardSlot object. To start communicating with the smart card, call the TKSmartCard.BeginSessionWithReply method on the TKSmartCard object. Once an exclusive session has been established, you transmit data using the TKSmartCard.TransmitRequestReply method. After you’ve finished communicating with a smart card, you call the TKSmartCard.EndSession method.

If the smart card is physically removed from its slot, the session object becomes invalid, and any further calls to TKSmartCard.TransmitRequestReply will return an error. You can use Key-Value Observing on the TKSmartCard.Valid property to be notified when a smart card is invalidated, due to being removed from the slot or another reason.

Configuring the Smart Card

Setting the Communication Protocol

Communicating with the Smart Card

Managing User Interaction

Configuring APDU Behavior

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard

func NewTKSmartCard

func NewTKSmartCard() TKSmartCard

NewTKSmartCard creates a new TKSmartCard instance.

func TKSmartCardFromID

func TKSmartCardFromID(id objc.ID) TKSmartCard

TKSmartCardFromID constructs a TKSmartCard from an objc.ID.

A representation of a smart card.

func (TKSmartCard) AllowedProtocols

func (t TKSmartCard) AllowedProtocols() TKSmartCardProtocol

The protocols allowed for communication with the Smart Card. TKSmartCardProtocolAny by default.

Discussion

This property is consulted only when beginning a session to a Smart Card. Any changes to this property will not be reflected by the current session, if one is already established.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/allowedProtocols

func (TKSmartCard) Autorelease

func (t TKSmartCard) Autorelease() TKSmartCard

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCard) BeginSessionWithReply

func (t TKSmartCard) BeginSessionWithReply(reply BoolErrorHandler)

Begins a session with the Smart Card.

reply: success: Whether the session could be established successfully. error: Contains information about the error preventing the transaction from being established.

The [NSError] object is created in the TKErrorDomain domain with a code in the TKError.Code enumeration.

Discussion

This method will fail if there is already an existing session for the Smart Card.

Calls to this method must be balanced with calls to TKSmartCard.EndSession.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/beginSession(reply:)

func (TKSmartCard) BeginSessionWithReplySync

func (t TKSmartCard) BeginSessionWithReplySync(ctx context.Context) (bool, error)

BeginSessionWithReplySync is a synchronous wrapper around TKSmartCard.BeginSessionWithReply. It blocks until the completion handler fires or the context is cancelled.

func (TKSmartCard) Cla

func (t TKSmartCard) Cla() uint8

The CLA byte used for APDU transmission. `0x00` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/cla

func (TKSmartCard) Context

func (t TKSmartCard) Context() objectivec.IObject

User-specified information. This property is automatically set to `nil` if the Smart Card is removed or another TKSmartCard object begins a session.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/context

func (TKSmartCard) CurrentProtocol

func (t TKSmartCard) CurrentProtocol() TKSmartCardProtocol

The protocol used for communication with the Smart Card. Returns TKSmartCardProtocolNone if no session is currently established.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/currentProtocol

func (TKSmartCard) EndSession

func (t TKSmartCard) EndSession()

Completes any pending transmissions and ends the session to the Smart Card.

Discussion

Calls to this method should balance calls to TKSmartCard.BeginSessionWithReply.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/endSession()

func (TKSmartCard) Init

func (t TKSmartCard) Init() TKSmartCard

Init initializes the instance.

func (TKSmartCard) Sensitive

func (t TKSmartCard) Sensitive() bool

Whether sessions established for the Smart Card should be considered sensitive. false by default.

Discussion

When this property is set to true, any sessions established for the receiver will begin and end by sending a reset command to the Smart Card. This is recommended anytime potentially sensitive information is transferred.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/isSensitive

func (TKSmartCard) SetAllowedProtocols

func (t TKSmartCard) SetAllowedProtocols(value TKSmartCardProtocol)

func (TKSmartCard) SetCla

func (t TKSmartCard) SetCla(value uint8)

func (TKSmartCard) SetContext

func (t TKSmartCard) SetContext(value objectivec.IObject)

func (TKSmartCard) SetSensitive

func (t TKSmartCard) SetSensitive(value bool)

func (TKSmartCard) SetUseCommandChaining

func (t TKSmartCard) SetUseCommandChaining(value bool)

func (TKSmartCard) SetUseExtendedLength

func (t TKSmartCard) SetUseExtendedLength(value bool)

func (TKSmartCard) Slot

func (t TKSmartCard) Slot() ITKSmartCardSlot

The slot in which the Smart Card is inserted.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/slot

func (TKSmartCard) TransmitRequestReply

func (t TKSmartCard) TransmitRequestReply(request foundation.NSData, reply DataErrorHandler)

Transmits data in Application Protocol Data Unit (APDU) format to the Smart Card.

request: The APDU request data.

reply: response: The APDU response data, or `nil` if communication with the Smart Card failed. error: Contains information about the the error preventing the transaction from being established.

The [NSError] object is created in the TKErrorDomain domain with a code in the TKError.Code enumeration.

Discussion

You should only call this method after a session to the Smart Card has been established using the TKSmartCard.BeginSessionWithReply method, and before the session is terminated using the TKSmartCard.EndSession method.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/transmit(_:reply:)

func (TKSmartCard) TransmitRequestReplySync

func (t TKSmartCard) TransmitRequestReplySync(ctx context.Context, request foundation.NSData) (*foundation.NSData, error)

TransmitRequestReplySync is a synchronous wrapper around TKSmartCard.TransmitRequestReply. It blocks until the completion handler fires or the context is cancelled.

func (TKSmartCard) UseCommandChaining

func (t TKSmartCard) UseCommandChaining() bool

Whether to use command chaining of APDU with a data field longer than 255 bytes.

Discussion

By default, this property is set to true when the Smart Card ATR announces that command chaining is supported.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/useCommandChaining

func (TKSmartCard) UseExtendedLength

func (t TKSmartCard) UseExtendedLength() bool

Whether to use extended length APDU.

Discussion

By default, this property is set to true when the Smart Card slot supports transmitting extended length commands, and the ATR announces that extended length APDU is supported.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/useExtendedLength

func (TKSmartCard) UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset

func (t TKSmartCard) UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset(PINFormat ITKSmartCardPINFormat, APDU foundation.NSData, currentPINByteOffset int, newPINByteOffset int) ITKSmartCardUserInteractionForSecurePINChange

Creates a new user interaction object for secure PIN change using the smart card reader facilities (typically a HW keypad).

PINFormat: The PIN format descriptor.

APDU: The Application Protocol Data Unit (APDU) used by the Smart Card to fill in PIN data.

currentPINByteOffset: The offset, in bytes, within the Application Protocol Data Unit (APDU) field to mark a location of a PIN block for filling in the entered PIN.

newPINByteOffset: The offset, in bytes, within the Application Protocol Data Unit (APDU) field to mark a location of a PIN block for filling in the new PIN.

Return Value

A new user interaction object for secure PIN verification, or `nil` if this feature is not supported by the Smart Card reader.

Discussion

You should only call this method after a session to the Smart Card has been established using the TKSmartCard.BeginSessionWithReply method, and before the session is terminated using the TKSmartCard.EndSession method.

Once the interaction has been successfully completed, the results are available via the TKSmartCardUserInteractionForPINOperation.ResultData and TKSmartCardUserInteractionForPINOperation.ResultSW properties of the returned TKSmartCardUserInteractionForSecurePINVerification object.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/userInteractionForSecurePINChange(_:apdu:currentPINByteOffset:newPINByteOffset:)

func (TKSmartCard) UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset

func (t TKSmartCard) UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset(PINFormat ITKSmartCardPINFormat, APDU foundation.NSData, PINByteOffset int) ITKSmartCardUserInteractionForSecurePINVerification

Creates and returns a new user interaction object for secure PIN verification using the Smart Card reader facilities.

PINFormat: The PIN format descriptor.

APDU: The Application Protocol Data Unit (APDU) used by the Smart Card to fill in PIN data.

PINByteOffset: The offset, in bytes, within the Application Protocol Data Unit (APDU) field to mark a location of a PIN block for filling in the entered PIN.

Return Value

A new user interaction object for secure PIN verification, or `nil` if this feature is not supported by the Smart Card reader.

Discussion

You should only call this method after a session to the Smart Card has been established using the TKSmartCard.BeginSessionWithReply method, and before the session is terminated using the TKSmartCard.EndSession method.

Once the interaction has been successfully completed, the results are available via the TKSmartCardUserInteractionForPINOperation.ResultData and TKSmartCardUserInteractionForPINOperation.ResultSW properties of the returned TKSmartCardUserInteractionForSecurePINVerification object.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/userInteractionForSecurePINVerification(_:apdu:pinByteOffset:)

func (TKSmartCard) Valid

func (t TKSmartCard) Valid() bool

Whether the Smart Card is valid and accessible from its slot.

Discussion

Use Key-Value-Observing to be notified for changes to accessibility, such as when a Smart Card is physically removed from its slot. For more information, see Key-Value Observing Programming Guide.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCard/isValid

type TKSmartCardATR

type TKSmartCardATR struct {
	objectivec.Object
}

A parsed ATR (Answer To Reset) message from a Smart Card.

Overview

This class declares a programmatic interface to parsing an ATR from data or a byte stream, and accessing the individual parts.

Creating a Smart Card ATR

Accessing ATR Attributes

Retrieving Interface Groups

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR

func NewTKSmartCardATR

func NewTKSmartCardATR() TKSmartCardATR

NewTKSmartCardATR creates a new TKSmartCardATR instance.

func NewTKSmartCardATRWithBytes

func NewTKSmartCardATRWithBytes(bytes foundation.NSData) TKSmartCardATR

Initializes a TKSmartCardATR object from a provided data object.

bytes: The ATR data to be parsed.

Return Value

A TKSmartCardATR object initialized with the parsed data. If `bytes` does not contain a valid ATR, returns `nil`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/init(bytes:)

func TKSmartCardATRFromID

func TKSmartCardATRFromID(id objc.ID) TKSmartCardATR

TKSmartCardATRFromID constructs a TKSmartCardATR from an objc.ID.

A parsed ATR (Answer To Reset) message from a Smart Card.

func (TKSmartCardATR) Autorelease

func (t TKSmartCardATR) Autorelease() TKSmartCardATR

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardATR) HistoricalBytes

func (t TKSmartCardATR) HistoricalBytes() foundation.NSData

The ATR historical bytes, not including interface bytes or the TCK (check byte).

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/historicalBytes

func (TKSmartCardATR) HistoricalRecords

func (t TKSmartCardATR) HistoricalRecords() []TKCompactTLVRecord

A list of compact TLV records parsed from historical bytes.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/historicalRecords

func (TKSmartCardATR) Init

func (t TKSmartCardATR) Init() TKSmartCardATR

Init initializes the instance.

func (TKSmartCardATR) InitWithBytes

func (t TKSmartCardATR) InitWithBytes(bytes foundation.NSData) TKSmartCardATR

Initializes a TKSmartCardATR object from a provided data object.

bytes: The ATR data to be parsed.

Return Value

A TKSmartCardATR object initialized with the parsed data. If `bytes` does not contain a valid ATR, returns `nil`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/init(bytes:)

func (TKSmartCardATR) InitWithSource

func (t TKSmartCardATR) InitWithSource(source IntVoidHandler) TKSmartCardATR

Initializes a TKSmartCardATR object from a provided data source.

source: The block providing a stream of data for an ATR.

The block takes no arguments and returns one byte. To indicate that an error occured, the block returns `-1`.

Return Value

A TKSmartCardATR object initialized with the parsed data. If the byte stream produces an error or does not contain a valid ATR, returns `nil`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/init(source:)

func (TKSmartCardATR) InterfaceGroupAtIndex

func (t TKSmartCardATR) InterfaceGroupAtIndex(index int) ITKSmartCardATRInterfaceGroup

Returns the interface group at the specified index.

index: The index of the desired interface group.

Return Value

The interface group at the specified index, or `nil` if not present.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/interfaceGroup(at:)

func (TKSmartCardATR) InterfaceGroupForProtocol

func (t TKSmartCardATR) InterfaceGroupForProtocol(protocol_ TKSmartCardProtocol) ITKSmartCardATRInterfaceGroup

Returns the interface group with the specified protocol.

protocol: The protocol used by the desired interface group.

Return Value

The interface group with the specified protocol, or `nil` if none exists.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/interfaceGroup(for:)

func (TKSmartCardATR) Protocols

func (t TKSmartCardATR) Protocols() []foundation.NSNumber

An array of protocols indicated in the ATR

Discussion

Each element in the returned array is an [NSNumber] object containing an [NSUInteger] value corresponding to a member of the TKSmartCardProtocol enumeration.

The returned protocols are ordered such that the default protocol is at index `0`, and any duplicate values are removed.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/protocols

type TKSmartCardATRClass

type TKSmartCardATRClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardATRClass

func GetTKSmartCardATRClass() TKSmartCardATRClass

GetTKSmartCardATRClass returns the class object for TKSmartCardATR.

func (TKSmartCardATRClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardATRClass) Class

func (tc TKSmartCardATRClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardATRInterfaceGroup

type TKSmartCardATRInterfaceGroup struct {
	objectivec.Object
}

A single interface-bytes group for a Smart Card ATR (Answer to Reset).

Overview

You access instances of this class by calling the TKSmartCardATR.InterfaceGroupAtIndex and TKSmartCardATR.InterfaceGroupForProtocol methods on an TKSmartCardATR object.

Accessing Interface Group Protocol and Bytes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup

func NewTKSmartCardATRInterfaceGroup

func NewTKSmartCardATRInterfaceGroup() TKSmartCardATRInterfaceGroup

NewTKSmartCardATRInterfaceGroup creates a new TKSmartCardATRInterfaceGroup instance.

func TKSmartCardATRInterfaceGroupFromID

func TKSmartCardATRInterfaceGroupFromID(id objc.ID) TKSmartCardATRInterfaceGroup

TKSmartCardATRInterfaceGroupFromID constructs a TKSmartCardATRInterfaceGroup from an objc.ID.

A single interface-bytes group for a Smart Card ATR (Answer to Reset).

func (TKSmartCardATRInterfaceGroup) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardATRInterfaceGroup) Init

Init initializes the instance.

func (TKSmartCardATRInterfaceGroup) Protocol

The protocol for this group.

Discussion

This property returns an [NSNumber] object containing an [NSUInteger] value corresponding to a member of the TKSmartCardProtocol enumeration.

This property is `nil` for the first interface group (global), as it has no assigned protocol.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup/protocol

func (TKSmartCardATRInterfaceGroup) TA

The TA interface byte of ATR group, or `nil` if TA is not present.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup/ta

func (TKSmartCardATRInterfaceGroup) TB

The TB interface byte of ATR group, or `nil` if TB is not present.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup/tb

func (TKSmartCardATRInterfaceGroup) TC

The TC interface byte of ATR group, or `nil` if TC is not present.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardATR/InterfaceGroup/tc

type TKSmartCardATRInterfaceGroupClass

type TKSmartCardATRInterfaceGroupClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardATRInterfaceGroupClass

func GetTKSmartCardATRInterfaceGroupClass() TKSmartCardATRInterfaceGroupClass

GetTKSmartCardATRInterfaceGroupClass returns the class object for TKSmartCardATRInterfaceGroup.

func (TKSmartCardATRInterfaceGroupClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardATRInterfaceGroupClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardClass

type TKSmartCardClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardClass

func GetTKSmartCardClass() TKSmartCardClass

GetTKSmartCardClass returns the class object for TKSmartCard.

func (TKSmartCardClass) Alloc

func (tc TKSmartCardClass) Alloc() TKSmartCard

Alloc allocates memory for a new instance of the class.

func (TKSmartCardClass) Class

func (tc TKSmartCardClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardPINCharset

type TKSmartCardPINCharset int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/Charset-swift.enum

const (
	TKSmartCardPINCharsetAlphanumeric      TKSmartCardPINCharset = 1
	TKSmartCardPINCharsetNumeric           TKSmartCardPINCharset = 0
	TKSmartCardPINCharsetUpperAlphanumeric TKSmartCardPINCharset = 2
)

func (TKSmartCardPINCharset) String

func (e TKSmartCardPINCharset) String() string

type TKSmartCardPINCompletion

type TKSmartCardPINCompletion uint

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation/Completion

const (
	TKSmartCardPINCompletionKey       TKSmartCardPINCompletion = 2
	TKSmartCardPINCompletionMaxLength TKSmartCardPINCompletion = 1
	TKSmartCardPINCompletionTimeout   TKSmartCardPINCompletion = 4
)

func (TKSmartCardPINCompletion) String

func (e TKSmartCardPINCompletion) String() string

type TKSmartCardPINConfirmation

type TKSmartCardPINConfirmation uint

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForSecurePINChange/Confirmation

const (
	TKSmartCardPINConfirmationCurrent TKSmartCardPINConfirmation = 2
	TKSmartCardPINConfirmationNew     TKSmartCardPINConfirmation = 1
	TKSmartCardPINConfirmationNone    TKSmartCardPINConfirmation = 0
)

func (TKSmartCardPINConfirmation) String

type TKSmartCardPINEncoding

type TKSmartCardPINEncoding int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/Encoding-swift.enum

const (
	TKSmartCardPINEncodingASCII  TKSmartCardPINEncoding = 1
	TKSmartCardPINEncodingBCD    TKSmartCardPINEncoding = 2
	TKSmartCardPINEncodingBinary TKSmartCardPINEncoding = 0
)

func (TKSmartCardPINEncoding) String

func (e TKSmartCardPINEncoding) String() string

type TKSmartCardPINFormat

type TKSmartCardPINFormat struct {
	objectivec.Object
}

The formatting properties for a PIN, such as character encoding and length constraints.

Overview

You typically interact with TKSmartCardPINFormat objects when calling the TKSmartCard.UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset and TKSmartCard.UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset methods on an instance of TKSmartCard.

Configuring PIN Formatting

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat

func NewTKSmartCardPINFormat

func NewTKSmartCardPINFormat() TKSmartCardPINFormat

NewTKSmartCardPINFormat creates a new TKSmartCardPINFormat instance.

func TKSmartCardPINFormatFromID

func TKSmartCardPINFormatFromID(id objc.ID) TKSmartCardPINFormat

TKSmartCardPINFormatFromID constructs a TKSmartCardPINFormat from an objc.ID.

The formatting properties for a PIN, such as character encoding and length constraints.

func (TKSmartCardPINFormat) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardPINFormat) Init

Init initializes the instance.

func (TKSmartCardPINFormat) MaxPINLength

func (t TKSmartCardPINFormat) MaxPINLength() int

The maximum number of characters to form a valid PIN. `8` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/maxPINLength

func (TKSmartCardPINFormat) MinPINLength

func (t TKSmartCardPINFormat) MinPINLength() int

The minimum number of characters to form a valid PIN. `4` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/minPINLength

func (TKSmartCardPINFormat) PINBitOffset

func (t TKSmartCardPINFormat) PINBitOffset() int

The offset, in bits, within the PIN block to mark a location for filling in the formatted PIN, which is justified with respect to the TKSmartCardPINFormat.PINJustification property value. `0` by default.

Discussion

The value of [PINBitOffset] indirectly controls the internal system units indicator. If [PINBitOffset] is byte aligned (that is, `PINBitOffset % 8 == 0`), the internal representation of [PINBitOffset] gets converted from bits to bytes.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/pinBitOffset

func (TKSmartCardPINFormat) PINBlockByteLength

func (t TKSmartCardPINFormat) PINBlockByteLength() int

The total length of the PIN block in bytes. `8` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/pinBlockByteLength

func (TKSmartCardPINFormat) PINLengthBitOffset

func (t TKSmartCardPINFormat) PINLengthBitOffset() int

The offset, in bits, within the PIN block to mark a location for filling in the PIN length, which is always left justified. `0` by default.

Discussion

The value of [PINLengthBitOffset] indirectly controls the internal system units indicator. If [PINLengthBitOffset] is byte aligned (that is, `PINLengthBitOffset % 8 == 0`), the internal representation of [PINLengthBitOffset] gets converted from bits to bytes.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/pinLengthBitOffset

func (TKSmartCardPINFormat) PINLengthBitSize

func (t TKSmartCardPINFormat) PINLengthBitSize() int

The size, in bits, of the PIN length field. If set to `0`, PIN length is not written. `0` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/pinLengthBitSize

func (TKSmartCardPINFormat) SetCharset

func (t TKSmartCardPINFormat) SetCharset(value TKSmartCardPINCharset)

func (TKSmartCardPINFormat) SetEncoding

func (t TKSmartCardPINFormat) SetEncoding(value TKSmartCardPINEncoding)

func (TKSmartCardPINFormat) SetMaxPINLength

func (t TKSmartCardPINFormat) SetMaxPINLength(value int)

func (TKSmartCardPINFormat) SetMinPINLength

func (t TKSmartCardPINFormat) SetMinPINLength(value int)

func (TKSmartCardPINFormat) SetPINBitOffset

func (t TKSmartCardPINFormat) SetPINBitOffset(value int)

func (TKSmartCardPINFormat) SetPINBlockByteLength

func (t TKSmartCardPINFormat) SetPINBlockByteLength(value int)

func (TKSmartCardPINFormat) SetPINJustification

func (t TKSmartCardPINFormat) SetPINJustification(value TKSmartCardPINJustification)

func (TKSmartCardPINFormat) SetPINLengthBitOffset

func (t TKSmartCardPINFormat) SetPINLengthBitOffset(value int)

func (TKSmartCardPINFormat) SetPINLengthBitSize

func (t TKSmartCardPINFormat) SetPINLengthBitSize(value int)

type TKSmartCardPINFormatClass

type TKSmartCardPINFormatClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardPINFormatClass

func GetTKSmartCardPINFormatClass() TKSmartCardPINFormatClass

GetTKSmartCardPINFormatClass returns the class object for TKSmartCardPINFormat.

func (TKSmartCardPINFormatClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardPINFormatClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardPINJustification

type TKSmartCardPINJustification int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardPINFormat/Justification

const (
	TKSmartCardPINJustificationLeft  TKSmartCardPINJustification = 0
	TKSmartCardPINJustificationRight TKSmartCardPINJustification = 1
)

func (TKSmartCardPINJustification) String

type TKSmartCardProtocol

type TKSmartCardProtocol uint

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardProtocol

const (
	// TKSmartCardProtocolAny: # Discussion
	TKSmartCardProtocolAny  TKSmartCardProtocol = 65535
	TKSmartCardProtocolNone TKSmartCardProtocol = 0
	// TKSmartCardProtocolT0: # Discussion
	TKSmartCardProtocolT0 TKSmartCardProtocol = 1
	// TKSmartCardProtocolT1: # Discussion
	TKSmartCardProtocolT1 TKSmartCardProtocol = 2
	// TKSmartCardProtocolT15: # Discussion
	TKSmartCardProtocolT15 TKSmartCardProtocol = 32768
)

func (TKSmartCardProtocol) String

func (e TKSmartCardProtocol) String() string

type TKSmartCardSlot

type TKSmartCardSlot struct {
	objectivec.Object
}

A single smart card reader slot in the system.

Overview

Use the TKSmartCardSlotManager class to manage all the smart card reader slots available to the system. You can retrieve the names of available smart card reader slots for a system using the TKSmartCardSlotManager.SlotNames property of a manager object, and access instances of TKSmartCardSlot using the TKSmartCardSlotManager.GetSlotWithNameReply method.

Instantiating Smart Cards

Getting the Slot State

Getting the Slot Configuration

  • TKSmartCardSlot.Name: The name of the Smart Card reader slot.
  • TKSmartCardSlot.MaxInputLength: The maximum length of input APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer to the Smart Card.
  • TKSmartCardSlot.MaxOutputLength: The maximum length of output APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer from the Smart Card.

Reading the Answer to Reset

  • TKSmartCardSlot.ATR: The ATR (Answer to Reset) of the inserted Smart Card, or `nil` if no Smart Card is inserted or the inserted Smart Card is mute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot

func NewTKSmartCardSlot

func NewTKSmartCardSlot() TKSmartCardSlot

NewTKSmartCardSlot creates a new TKSmartCardSlot instance.

func TKSmartCardSlotFromID

func TKSmartCardSlotFromID(id objc.ID) TKSmartCardSlot

TKSmartCardSlotFromID constructs a TKSmartCardSlot from an objc.ID.

A single smart card reader slot in the system.

func (TKSmartCardSlot) ATR

The ATR (Answer to Reset) of the inserted Smart Card, or `nil` if no Smart Card is inserted or the inserted Smart Card is mute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/atr

func (TKSmartCardSlot) Autorelease

func (t TKSmartCardSlot) Autorelease() TKSmartCardSlot

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardSlot) Init

Init initializes the instance.

func (TKSmartCardSlot) MakeSmartCard

func (t TKSmartCardSlot) MakeSmartCard() ITKSmartCard

Creates a new TKSmartCard object representing the currently inserted Smart Card.

Return Value

A new TKSmartCard object, or `nil` if no Smart Card is currently inserted.

Discussion

You can create multiple instances of TKSmartCard that represent the same Smart Card. Exclusivity of data transfer is handled by sessions on the individual TKSmartCard objects.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/makeSmartCard()

func (TKSmartCardSlot) MaxInputLength

func (t TKSmartCardSlot) MaxInputLength() int

The maximum length of input APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer to the Smart Card.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/maxInputLength

func (TKSmartCardSlot) MaxOutputLength

func (t TKSmartCardSlot) MaxOutputLength() int

The maximum length of output APDU (Application Protocol Data Unit) that the Smart Card reader slot is able to transfer from the Smart Card.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/maxOutputLength

func (TKSmartCardSlot) Name

func (t TKSmartCardSlot) Name() string

The name of the Smart Card reader slot.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/name

func (TKSmartCardSlot) State

The current state of the Smart Card reader slot.

Discussion

Use Key-Value-Observing to be notified for changes to the state. For more information, see Key-Value Observing Programming Guide.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/state-swift.property

type TKSmartCardSlotClass

type TKSmartCardSlotClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardSlotClass

func GetTKSmartCardSlotClass() TKSmartCardSlotClass

GetTKSmartCardSlotClass returns the class object for TKSmartCardSlot.

func (TKSmartCardSlotClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardSlotClass) Class

func (tc TKSmartCardSlotClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardSlotHandler

type TKSmartCardSlotHandler = func(*TKSmartCardSlot)

TKSmartCardSlotHandler handles slot: The Smart Card reader slot corresponding to the specified name.

  • slot: The Smart Card reader slot corresponding to the specified name. If no slot exists with that name, this argument is `nil`.

Used by:

type TKSmartCardSlotManager

type TKSmartCardSlotManager struct {
	objectivec.Object
}

An interface to all available smart card reader slots.

Overview

Get a list of all known smart card reader slots in the system using the TKSmartCardSlotManager.SlotNames property, and access individual slots by name using the TKSmartCardSlotManager.GetSlotWithNameReply method.

Accessing Smart Card Slots

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager

func NewTKSmartCardSlotManager

func NewTKSmartCardSlotManager() TKSmartCardSlotManager

NewTKSmartCardSlotManager creates a new TKSmartCardSlotManager instance.

func TKSmartCardSlotManagerFromID

func TKSmartCardSlotManagerFromID(id objc.ID) TKSmartCardSlotManager

TKSmartCardSlotManagerFromID constructs a TKSmartCardSlotManager from an objc.ID.

An interface to all available smart card reader slots.

func (TKSmartCardSlotManager) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardSlotManager) GetSlotWithNameReply

func (t TKSmartCardSlotManager) GetSlotWithNameReply(name string, reply TKSmartCardSlotHandler)

Asynchronously calls a block with a Smart Card reader slot for a specified name.

name: The name of the Smart Card reader slot.

reply: slot: The Smart Card reader slot corresponding to the specified name. If no slot exists with that name, this argument is `nil`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager/getSlot(withName:reply:)

func (TKSmartCardSlotManager) GetSlotWithNameReplySync

func (t TKSmartCardSlotManager) GetSlotWithNameReplySync(ctx context.Context, name string) (*TKSmartCardSlot, error)

GetSlotWithNameReplySync is a synchronous wrapper around TKSmartCardSlotManager.GetSlotWithNameReply. It blocks until the completion handler fires or the context is cancelled.

func (TKSmartCardSlotManager) Init

Init initializes the instance.

func (TKSmartCardSlotManager) SlotNamed

Returns the Smart Card slot with a given name.

Return Value

The slot with the specified name, or `nil` if no slot with that name exists.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager/slotNamed(_:)

func (TKSmartCardSlotManager) SlotNames

func (t TKSmartCardSlotManager) SlotNames() []string

A list of identifiers for all the Smart Card reader slots available to the system.

Discussion

Use Key-Value Observing on this property to be notified for changes to available Smart Card reader slots. For more information, see Key-Value Observing Programming Guide.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager/slotNames

type TKSmartCardSlotManagerClass

type TKSmartCardSlotManagerClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardSlotManagerClass

func GetTKSmartCardSlotManagerClass() TKSmartCardSlotManagerClass

GetTKSmartCardSlotManagerClass returns the class object for TKSmartCardSlotManager.

func (TKSmartCardSlotManagerClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardSlotManagerClass) Class

Class returns the underlying Objective-C class pointer.

func (TKSmartCardSlotManagerClass) DefaultManager

func (_TKSmartCardSlotManagerClass TKSmartCardSlotManagerClass) DefaultManager() TKSmartCardSlotManager

The shared singleton Smart Card reader slot manager.

Discussion

This method returns `nil` unless the com.apple.security.smartcard entitlement is enabled.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlotManager/default

type TKSmartCardSlotNFCSessionErrorHandler

type TKSmartCardSlotNFCSessionErrorHandler = func(*uintptr, error)

TKSmartCardSlotNFCSessionErrorHandler handles Completion handler which returns the NFC session of the created slot or an error on failure.

Used by:

  • [TKSmartCardSlotManager.CreateNFCSlotWithMessageCompletion]

type TKSmartCardSlotState

type TKSmartCardSlotState int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardSlot/State-swift.enum

const (
	TKSmartCardSlotStateEmpty     TKSmartCardSlotState = 1
	TKSmartCardSlotStateMissing   TKSmartCardSlotState = 0
	TKSmartCardSlotStateMuteCard  TKSmartCardSlotState = 3
	TKSmartCardSlotStateProbing   TKSmartCardSlotState = 2
	TKSmartCardSlotStateValidCard TKSmartCardSlotState = 4
)

func (TKSmartCardSlotState) String

func (e TKSmartCardSlotState) String() string

type TKSmartCardToken

type TKSmartCardToken struct {
	TKToken
}

A representation of a smart card based cryptographic token.

Creating Smart Card Tokens

Accessing the Application Identifier

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardToken

func NewTKSmartCardToken

func NewTKSmartCardToken() TKSmartCardToken

NewTKSmartCardToken creates a new TKSmartCardToken instance.

func NewTKSmartCardTokenWithSmartCardAIDInstanceIDTokenDriver

func NewTKSmartCardTokenWithSmartCardAIDInstanceIDTokenDriver(smartCard ITKSmartCard, AID foundation.NSData, instanceID string, tokenDriver ITKSmartCardTokenDriver) TKSmartCardToken

Initializes a smart card token with the specified smart card, application identifier, and token driver.

smartCard: The smart card on which the created token should operate.

AID: The ISO 7816-4 application identifier for the smart card.

instanceID: A unique, persistent identifier for this token. This value is typically generated from the serial number of the target hardware.

tokenDriver: The driver associated with the created token.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardToken/init(smartCard:aid:instanceID:tokenDriver:)

func NewTKSmartCardTokenWithTokenDriverInstanceID

func NewTKSmartCardTokenWithTokenDriverInstanceID(tokenDriver ITKTokenDriver, instanceID TKTokenInstanceID) TKSmartCardToken

Initializes a token with the driver you specify.

tokenDriver: The driver of the token.

instanceID: A unique, persistent identifier for this token. This value is typically generated from the serial number of the target hardware.

Return Value

A new token object.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/init(tokenDriver:instanceID:)

func TKSmartCardTokenFromID

func TKSmartCardTokenFromID(id objc.ID) TKSmartCardToken

TKSmartCardTokenFromID constructs a TKSmartCardToken from an objc.ID.

A representation of a smart card based cryptographic token.

func (TKSmartCardToken) AID

The ISO 7816-4 application identifiers of the Smart Card.

Discussion

This value is specified in the Smart Card token extension’s [NSExtensionAttributes] property list by the `com.AppleXCUIElementTypeCtkXCUIElementTypeAid()` attribute. If this attribute specifies multiple AIDs, this parameter represents the application identifier found on the card that is already preselected. If the `com.AppleXCUIElementTypeCtkXCUIElementTypeAid()` attribute is not present, no application is automatically preselected and the value of this property is `nil`.

For more information, see App Extension Keys in Information Property List Key Reference.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardToken/aid

func (TKSmartCardToken) Autorelease

func (t TKSmartCardToken) Autorelease() TKSmartCardToken

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardToken) Init

Init initializes the instance.

func (TKSmartCardToken) InitWithSmartCardAIDInstanceIDTokenDriver

func (t TKSmartCardToken) InitWithSmartCardAIDInstanceIDTokenDriver(smartCard ITKSmartCard, AID foundation.NSData, instanceID string, tokenDriver ITKSmartCardTokenDriver) TKSmartCardToken

Initializes a smart card token with the specified smart card, application identifier, and token driver.

smartCard: The smart card on which the created token should operate.

AID: The ISO 7816-4 application identifier for the smart card.

instanceID: A unique, persistent identifier for this token. This value is typically generated from the serial number of the target hardware.

tokenDriver: The driver associated with the created token.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardToken/init(smartCard:aid:instanceID:tokenDriver:)

type TKSmartCardTokenClass

type TKSmartCardTokenClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardTokenClass

func GetTKSmartCardTokenClass() TKSmartCardTokenClass

GetTKSmartCardTokenClass returns the class object for TKSmartCardToken.

func (TKSmartCardTokenClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardTokenClass) Class

func (tc TKSmartCardTokenClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardTokenDriver

type TKSmartCardTokenDriver struct {
	TKTokenDriver
}

The driver that acts as an entry point for smart card app extensions.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenDriver

func NewTKSmartCardTokenDriver

func NewTKSmartCardTokenDriver() TKSmartCardTokenDriver

NewTKSmartCardTokenDriver creates a new TKSmartCardTokenDriver instance.

func TKSmartCardTokenDriverFromID

func TKSmartCardTokenDriverFromID(id objc.ID) TKSmartCardTokenDriver

TKSmartCardTokenDriverFromID constructs a TKSmartCardTokenDriver from an objc.ID.

The driver that acts as an entry point for smart card app extensions.

func (TKSmartCardTokenDriver) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardTokenDriver) Init

Init initializes the instance.

type TKSmartCardTokenDriverClass

type TKSmartCardTokenDriverClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardTokenDriverClass

func GetTKSmartCardTokenDriverClass() TKSmartCardTokenDriverClass

GetTKSmartCardTokenDriverClass returns the class object for TKSmartCardTokenDriver.

func (TKSmartCardTokenDriverClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardTokenDriverClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardTokenDriverDelegate

type TKSmartCardTokenDriverDelegate interface {
	objectivec.IObject
	TKTokenDriverDelegate

	// Tells the delegate that a new Smart Card is detected.
	//
	// See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenDriverDelegate/tokenDriver(_:createTokenFor:aid:)
	TokenDriverCreateTokenForSmartCardAIDError(driver ITKSmartCardTokenDriver, smartCard ITKSmartCard, AID foundation.NSData) (ITKSmartCardToken, error)
}

The interface that a smart card token driver delegate implements to respond to token creation events.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenDriverDelegate

type TKSmartCardTokenDriverDelegateConfig

type TKSmartCardTokenDriverDelegateConfig struct {

	// Other Methods
	// TokenDriverCreateTokenForSmartCardAIDError — Tells the delegate that a new Smart Card is detected.
	TokenDriverCreateTokenForSmartCardAIDError func(driver TKSmartCardTokenDriver, smartCard TKSmartCard, AID foundation.NSData, error_ foundation.NSError) TKSmartCardToken
}

TKSmartCardTokenDriverDelegateConfig holds optional typed callbacks for TKSmartCardTokenDriverDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type TKSmartCardTokenDriverDelegateObject

type TKSmartCardTokenDriverDelegateObject struct {
	objectivec.Object
}

TKSmartCardTokenDriverDelegateObject wraps an existing Objective-C object that conforms to the TKSmartCardTokenDriverDelegate protocol.

func NewTKSmartCardTokenDriverDelegate

func NewTKSmartCardTokenDriverDelegate(config TKSmartCardTokenDriverDelegateConfig) TKSmartCardTokenDriverDelegateObject

NewTKSmartCardTokenDriverDelegate creates an Objective-C object implementing the TKSmartCardTokenDriverDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned TKSmartCardTokenDriverDelegateObject satisfies the TKSmartCardTokenDriverDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func TKSmartCardTokenDriverDelegateObjectFromID

func TKSmartCardTokenDriverDelegateObjectFromID(id objc.ID) TKSmartCardTokenDriverDelegateObject

TKSmartCardTokenDriverDelegateObjectFromID constructs a TKSmartCardTokenDriverDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (TKSmartCardTokenDriverDelegateObject) BaseObject

func (TKSmartCardTokenDriverDelegateObject) TokenDriverCreateTokenForSmartCardAIDError

func (o TKSmartCardTokenDriverDelegateObject) TokenDriverCreateTokenForSmartCardAIDError(driver ITKSmartCardTokenDriver, smartCard ITKSmartCard, AID foundation.NSData) (ITKSmartCardToken, error)

Tells the delegate that a new Smart Card is detected.

driver: The Smart Card token driver.

smartCard: The detected Smart Card.

AID: The ISO 7816-4 application identifier that is selected on the Smart Card. If the `com.AppleXCUIElementTypeCtkXCUIElementTypeAid()` attributes is not present in the Smart Card token extension property list, no application is selected.

Return Value

The token created for the Smart Card, or `nil` if an error occurs or the delegate decides not to provide a token.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenDriverDelegate/tokenDriver(_:createTokenFor:aid:)

func (TKSmartCardTokenDriverDelegateObject) TokenDriverTerminateToken

func (o TKSmartCardTokenDriverDelegateObject) TokenDriverTerminateToken(driver ITKTokenDriver, token ITKToken)

Tells the delegate to terminate the token you specify.

driver: The token driver.

token: The token to be terminated.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriverDelegate/tokenDriver(_:terminateToken:)

func (TKSmartCardTokenDriverDelegateObject) TokenDriverTokenForConfigurationError

func (o TKSmartCardTokenDriverDelegateObject) TokenDriverTokenForConfigurationError(driver ITKTokenDriver, configuration ITKTokenConfiguration) (ITKToken, error)

Creates a new token for the configuration you specify.

driver: The token driver.

configuration: The configuration that identifies the token to create.

Return Value

The created token.

Discussion

The system invokes this method to request creation of a token instance, which the TKTokenConfiguration.InstanceID property of the configuration you specify identifies.

The created token has access to its current configuration using the TKTokenConfiguration.ConfigurationData property, which can provide token-implementation-specific additional data. The token can access keychain items this token exports with the methods TKTokenConfiguration.KeyForObjectIDError and TKTokenConfiguration.CertificateForObjectIDError that the configuration provides.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriverDelegate/tokenDriver(_:tokenFor:)

type TKSmartCardTokenSession

type TKSmartCardTokenSession struct {
	TKTokenSession
}

A token session that is based on a smart card token.

Overview

You can use the TKSmartCardTokenSession.SmartCard property to access and send APDUs to the underlying smart card.

Accessing the Smart Card

Instance Methods

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenSession

func NewTKSmartCardTokenSession

func NewTKSmartCardTokenSession() TKSmartCardTokenSession

NewTKSmartCardTokenSession creates a new TKSmartCardTokenSession instance.

func NewTKSmartCardTokenSessionWithToken

func NewTKSmartCardTokenSessionWithToken(token ITKToken) TKSmartCardTokenSession

Initializes a token session with the specified token.

token: The token to which the initialized session is bound.

Return Value

A new token session created with the specified token.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession/init(token:)

func TKSmartCardTokenSessionFromID

func TKSmartCardTokenSessionFromID(id objc.ID) TKSmartCardTokenSession

TKSmartCardTokenSessionFromID constructs a TKSmartCardTokenSession from an objc.ID.

A token session that is based on a smart card token.

func (TKSmartCardTokenSession) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardTokenSession) GetSmartCardWithError

func (t TKSmartCardTokenSession) GetSmartCardWithError() (ITKSmartCard, error)

Discussion

Returns a TKSmartCard instance with an active exclusive session and the SmartCard application selected. Replaces the deprecated @c smartCard property.

The TKSmartCard object is only accessible within the methods of the TKTokenSessionDelegate protocol. If the associated token has an AID set, the returned card will have an exclusive session already opened and the specified application selected. In this scenario: Do not call -[TKSmartCard beginSessionWithReply:]) on the returned SmartCard instance. The system manages the session lifecycle and will terminate it automatically when the current token request servicing is finished. Do not call -[TKSmartCard endSession]. You can use the `smartCard.Context()` property to store any context-specific state information related to the card. This property is automatically set to `nil` if the card is reset or accessed by a different TKSmartCard instance (potentially in another process). Before performing an operation, check the `TKSmartCard.Context()` property for a previously stored value. This can help you avoid potentially costly restoration of the SmartCard state if it’s already available.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenSession/getSmartCard()

func (TKSmartCardTokenSession) Init

Init initializes the instance.

func (TKSmartCardTokenSession) SmartCard

func (t TKSmartCardTokenSession) SmartCard() ITKSmartCard

The smart card for the active exclusive session and selected application.

Discussion

This property can only be accessed in the implementation of a TKTokenSessionDelegate protocol delegate method. If the associated token has a value set for the TKSmartCardToken.AID property, this property opens an exclusive session to the card, with the application already selected.

You should not call TKSmartCard.BeginSessionWithReply or TKSmartCard.EndSession on the returned value. Instead, the system will take care of beginning the exclusive session and terminating it when the current token request servicing is finished.

You can store any kind of information representing state of the card using the TKSmartCard.Context property. This property will be automatically set to `nil` if the card is reset or accessed by different TKSmartCard instance, such as by another process. You can check the TKSmartCard.Context property for any previously stored values as a way to avoid costly state restoration before performing an operation.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardTokenSession/smartCard

type TKSmartCardTokenSessionClass

type TKSmartCardTokenSessionClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardTokenSessionClass

func GetTKSmartCardTokenSessionClass() TKSmartCardTokenSessionClass

GetTKSmartCardTokenSessionClass returns the class object for TKSmartCardTokenSession.

func (TKSmartCardTokenSessionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardTokenSessionClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardUserInteraction

type TKSmartCardUserInteraction struct {
	objectivec.Object
}

The base class for encapsulating user interaction with a Smart Card reader.

Overview

There are two types of user interactions: those for secure PIN change and those for secure PIN validation. These interactions are instances of the TKSmartCardUserInteractionForSecurePINChange, or TKSmartCardUserInteractionForSecurePINVerification subclasses of TKSmartCardUserInteractionForPINOperation, respectively. TKSmartCardUserInteractionForPINOperation is a subclass of TKSmartCardUserInteraction.

You interact with instances of one of the subclasses of [TKSmartCardUserInteractionForPINOperation]when calling the TKSmartCard.UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset and TKSmartCard.UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset methods on an TKSmartCard object.

Handling User Interaction Events

Configuring Timeout

Starting and Stopping

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction

func NewTKSmartCardUserInteraction

func NewTKSmartCardUserInteraction() TKSmartCardUserInteraction

NewTKSmartCardUserInteraction creates a new TKSmartCardUserInteraction instance.

func TKSmartCardUserInteractionFromID

func TKSmartCardUserInteractionFromID(id objc.ID) TKSmartCardUserInteraction

TKSmartCardUserInteractionFromID constructs a TKSmartCardUserInteraction from an objc.ID.

The base class for encapsulating user interaction with a Smart Card reader.

func (TKSmartCardUserInteraction) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardUserInteraction) Cancel

func (t TKSmartCardUserInteraction) Cancel() bool

Attempts to cancel an interaction started by calling TKSmartCardUserInteraction.RunWithReply. For certain interactions, cancellation may not be available.

Return Value

Returns false if the operation is not running, or if cancelation is not supported.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/cancel()

func (TKSmartCardUserInteraction) Delegate

The delegate for observing events that occur during the user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/delegate

func (TKSmartCardUserInteraction) Init

Init initializes the instance.

func (TKSmartCardUserInteraction) InitialTimeout

The timeout, in seconds, for initial interaction. If set to `0`, the reader-defined default timeout is used. `0` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/initialTimeout

func (TKSmartCardUserInteraction) InteractionTimeout

func (t TKSmartCardUserInteraction) InteractionTimeout() foundation.NSTimeInterval

The timeout, in seconds, after the first key stroke. If set to `0`, the reader-defined default timeout is used. `0` by default.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/interactionTimeout

func (TKSmartCardUserInteraction) RunWithReply

func (t TKSmartCardUserInteraction) RunWithReply(reply BoolErrorHandler)

Runs the user interaction and asynchronously receives a reply.

reply: success: Whether the user interaction was successful. error: Contains information about the the error that occurred during the user interaction.

The [NSError] object is created in the TKErrorDomain domain with a code in the TKError.Code enumeration.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteraction/run(reply:)

func (TKSmartCardUserInteraction) RunWithReplySync

func (t TKSmartCardUserInteraction) RunWithReplySync(ctx context.Context) (bool, error)

RunWithReplySync is a synchronous wrapper around TKSmartCardUserInteraction.RunWithReply. It blocks until the completion handler fires or the context is cancelled.

func (TKSmartCardUserInteraction) SetDelegate

func (TKSmartCardUserInteraction) SetInitialTimeout

func (t TKSmartCardUserInteraction) SetInitialTimeout(value foundation.NSTimeInterval)

func (TKSmartCardUserInteraction) SetInteractionTimeout

func (t TKSmartCardUserInteraction) SetInteractionTimeout(value foundation.NSTimeInterval)

type TKSmartCardUserInteractionClass

type TKSmartCardUserInteractionClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardUserInteractionClass

func GetTKSmartCardUserInteractionClass() TKSmartCardUserInteractionClass

GetTKSmartCardUserInteractionClass returns the class object for TKSmartCardUserInteraction.

func (TKSmartCardUserInteractionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardUserInteractionClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardUserInteractionDelegate

type TKSmartCardUserInteractionDelegate interface {
	objectivec.IObject
}

The interface implemented by a Smart Card user interaction delegate to handle user interaction events.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate

type TKSmartCardUserInteractionDelegateConfig

type TKSmartCardUserInteractionDelegateConfig struct {

	// Other Methods
	// CharacterEnteredInUserInteraction — Tells the delegate that a valid character has been entered.
	CharacterEnteredInUserInteraction func(interaction TKSmartCardUserInteraction)
	// CorrectionKeyPressedInUserInteraction — Tells the delegate that a correction key has been pressed.
	CorrectionKeyPressedInUserInteraction func(interaction TKSmartCardUserInteraction)
	// ValidationKeyPressedInUserInteraction — Tells the delegate that the validation key has been pressed, indicating the end of PIN entry.
	ValidationKeyPressedInUserInteraction func(interaction TKSmartCardUserInteraction)
	// InvalidCharacterEnteredInUserInteraction — Tells the delegate that an invalid character has been entered.
	InvalidCharacterEnteredInUserInteraction func(interaction TKSmartCardUserInteraction)
	// OldPINRequestedInUserInteraction — Tells the delegate that the old PIN needs to be entered.
	OldPINRequestedInUserInteraction func(interaction TKSmartCardUserInteraction)
	// NewPINRequestedInUserInteraction — Tells the delegate that the new PIN needs to be entered.
	NewPINRequestedInUserInteraction func(interaction TKSmartCardUserInteraction)
	// NewPINConfirmationRequestedInUserInteraction — Tells the delegate that the new PIN needs to be re-entered for confirmation.
	NewPINConfirmationRequestedInUserInteraction func(interaction TKSmartCardUserInteraction)
}

TKSmartCardUserInteractionDelegateConfig holds optional typed callbacks for TKSmartCardUserInteractionDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type TKSmartCardUserInteractionDelegateObject

type TKSmartCardUserInteractionDelegateObject struct {
	objectivec.Object
}

TKSmartCardUserInteractionDelegateObject wraps an existing Objective-C object that conforms to the TKSmartCardUserInteractionDelegate protocol.

func NewTKSmartCardUserInteractionDelegate

func NewTKSmartCardUserInteractionDelegate(config TKSmartCardUserInteractionDelegateConfig) TKSmartCardUserInteractionDelegateObject

NewTKSmartCardUserInteractionDelegate creates an Objective-C object implementing the TKSmartCardUserInteractionDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned TKSmartCardUserInteractionDelegateObject satisfies the TKSmartCardUserInteractionDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func TKSmartCardUserInteractionDelegateObjectFromID

func TKSmartCardUserInteractionDelegateObjectFromID(id objc.ID) TKSmartCardUserInteractionDelegateObject

TKSmartCardUserInteractionDelegateObjectFromID constructs a TKSmartCardUserInteractionDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (TKSmartCardUserInteractionDelegateObject) BaseObject

func (TKSmartCardUserInteractionDelegateObject) CharacterEnteredInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) CharacterEnteredInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that a valid character has been entered.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/characterEntered(in:)

func (TKSmartCardUserInteractionDelegateObject) CorrectionKeyPressedInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) CorrectionKeyPressedInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that a correction key has been pressed.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/correctionKeyPressed(in:)

func (TKSmartCardUserInteractionDelegateObject) InvalidCharacterEnteredInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) InvalidCharacterEnteredInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that an invalid character has been entered.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/invalidCharacterEntered(in:)

func (TKSmartCardUserInteractionDelegateObject) NewPINConfirmationRequestedInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) NewPINConfirmationRequestedInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that the new PIN needs to be re-entered for confirmation.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/newPINConfirmationRequested(in:)

func (TKSmartCardUserInteractionDelegateObject) NewPINRequestedInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) NewPINRequestedInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that the new PIN needs to be entered.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/newPINRequested(in:)

func (TKSmartCardUserInteractionDelegateObject) OldPINRequestedInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) OldPINRequestedInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that the old PIN needs to be entered.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/oldPINRequested(in:)

func (TKSmartCardUserInteractionDelegateObject) ValidationKeyPressedInUserInteraction

func (o TKSmartCardUserInteractionDelegateObject) ValidationKeyPressedInUserInteraction(interaction ITKSmartCardUserInteraction)

Tells the delegate that the validation key has been pressed, indicating the end of PIN entry.

interaction: The user interaction.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionDelegate/validationKeyPressed(in:)

type TKSmartCardUserInteractionForPINOperation

type TKSmartCardUserInteractionForPINOperation struct {
	TKSmartCardUserInteraction
}

A representation of user interaction for secure PIN operations on a Smart Card reader.

Overview

There are two types of user interactions: those for secure PIN change and those for secure PIN validation. These interactions are instances of the TKSmartCardUserInteractionForSecurePINChange, or TKSmartCardUserInteractionForSecurePINVerification subclasses of TKSmartCardUserInteractionForPINOperation, respectively.

You interact with instances of one of the subclasses of TKSmartCardUserInteractionForPINOperation when calling the TKSmartCard.UserInteractionForSecurePINChangeWithPINFormatAPDUCurrentPINByteOffsetNewPINByteOffset and TKSmartCard.UserInteractionForSecurePINVerificationWithPINFormatAPDUPINByteOffset methods on an TKSmartCard object.

The result of a user interaction is available once the interaction has completed.

Managing Pin Completion

Configuring Messages

Accessing Response Data

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation

func NewTKSmartCardUserInteractionForPINOperation

func NewTKSmartCardUserInteractionForPINOperation() TKSmartCardUserInteractionForPINOperation

NewTKSmartCardUserInteractionForPINOperation creates a new TKSmartCardUserInteractionForPINOperation instance.

func TKSmartCardUserInteractionForPINOperationFromID

func TKSmartCardUserInteractionForPINOperationFromID(id objc.ID) TKSmartCardUserInteractionForPINOperation

TKSmartCardUserInteractionForPINOperationFromID constructs a TKSmartCardUserInteractionForPINOperation from an objc.ID.

A representation of user interaction for secure PIN operations on a Smart Card reader.

func (TKSmartCardUserInteractionForPINOperation) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardUserInteractionForPINOperation) Init

Init initializes the instance.

func (TKSmartCardUserInteractionForPINOperation) Locale

The locale for the displayed messages. If `nil`, the user’s current locale is used. By default, this value is the current locale of the system.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation/locale

func (TKSmartCardUserInteractionForPINOperation) PINCompletion

The conditions under which PIN entry should be considered complete.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation/pinCompletion

func (TKSmartCardUserInteractionForPINOperation) PINMessageIndices

A list of message indices referring to a predefined message table, used to specify the type and number of messages displayed during the PIN operation. `nil` by default.

Discussion

If `nil`, the reader does not display any message (reader specific). Typically, PIN verification takes 1 message; PIN modification takes 1 – 3 messages.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation/pinMessageIndices

func (TKSmartCardUserInteractionForPINOperation) ResultData

The returned data without SW1-SW2 bytes, if any.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForPINOperation/resultData

func (TKSmartCardUserInteractionForPINOperation) SetLocale

func (TKSmartCardUserInteractionForPINOperation) SetPINCompletion

func (TKSmartCardUserInteractionForPINOperation) SetPINMessageIndices

func (t TKSmartCardUserInteractionForPINOperation) SetPINMessageIndices(value []foundation.NSNumber)

func (TKSmartCardUserInteractionForPINOperation) SetResultData

func (TKSmartCardUserInteractionForPINOperation) SetResultSW

type TKSmartCardUserInteractionForPINOperationClass

type TKSmartCardUserInteractionForPINOperationClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardUserInteractionForPINOperationClass

func GetTKSmartCardUserInteractionForPINOperationClass() TKSmartCardUserInteractionForPINOperationClass

GetTKSmartCardUserInteractionForPINOperationClass returns the class object for TKSmartCardUserInteractionForPINOperation.

func (TKSmartCardUserInteractionForPINOperationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardUserInteractionForPINOperationClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardUserInteractionForSecurePINChange

type TKSmartCardUserInteractionForSecurePINChange struct {
	TKSmartCardUserInteractionForPINOperation
}

A representation of the user interaction for secure PIN change operations on a Smart Card reader.

Overview

The result of a user interaction is available once the interaction has completed.

Configuring User Interaction

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForSecurePINChange

func NewTKSmartCardUserInteractionForSecurePINChange

func NewTKSmartCardUserInteractionForSecurePINChange() TKSmartCardUserInteractionForSecurePINChange

NewTKSmartCardUserInteractionForSecurePINChange creates a new TKSmartCardUserInteractionForSecurePINChange instance.

func TKSmartCardUserInteractionForSecurePINChangeFromID

func TKSmartCardUserInteractionForSecurePINChangeFromID(id objc.ID) TKSmartCardUserInteractionForSecurePINChange

TKSmartCardUserInteractionForSecurePINChangeFromID constructs a TKSmartCardUserInteractionForSecurePINChange from an objc.ID.

A representation of the user interaction for secure PIN change operations on a Smart Card reader.

func (TKSmartCardUserInteractionForSecurePINChange) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardUserInteractionForSecurePINChange) Init

Init initializes the instance.

func (TKSmartCardUserInteractionForSecurePINChange) SetPINConfirmation

type TKSmartCardUserInteractionForSecurePINChangeClass

type TKSmartCardUserInteractionForSecurePINChangeClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardUserInteractionForSecurePINChangeClass

func GetTKSmartCardUserInteractionForSecurePINChangeClass() TKSmartCardUserInteractionForSecurePINChangeClass

GetTKSmartCardUserInteractionForSecurePINChangeClass returns the class object for TKSmartCardUserInteractionForSecurePINChange.

func (TKSmartCardUserInteractionForSecurePINChangeClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardUserInteractionForSecurePINChangeClass) Class

Class returns the underlying Objective-C class pointer.

type TKSmartCardUserInteractionForSecurePINVerification

type TKSmartCardUserInteractionForSecurePINVerification struct {
	TKSmartCardUserInteractionForPINOperation
}

A representation of the user interaction for secure PIN change verification on a Smart Card reader.

Overview

The result of a user interaction is available once the interaction has completed.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKSmartCardUserInteractionForSecurePINVerification

func NewTKSmartCardUserInteractionForSecurePINVerification

func NewTKSmartCardUserInteractionForSecurePINVerification() TKSmartCardUserInteractionForSecurePINVerification

NewTKSmartCardUserInteractionForSecurePINVerification creates a new TKSmartCardUserInteractionForSecurePINVerification instance.

func TKSmartCardUserInteractionForSecurePINVerificationFromID

func TKSmartCardUserInteractionForSecurePINVerificationFromID(id objc.ID) TKSmartCardUserInteractionForSecurePINVerification

TKSmartCardUserInteractionForSecurePINVerificationFromID constructs a TKSmartCardUserInteractionForSecurePINVerification from an objc.ID.

A representation of the user interaction for secure PIN change verification on a Smart Card reader.

func (TKSmartCardUserInteractionForSecurePINVerification) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKSmartCardUserInteractionForSecurePINVerification) Init

Init initializes the instance.

type TKSmartCardUserInteractionForSecurePINVerificationClass

type TKSmartCardUserInteractionForSecurePINVerificationClass struct {
	// contains filtered or unexported fields
}

func GetTKSmartCardUserInteractionForSecurePINVerificationClass

func GetTKSmartCardUserInteractionForSecurePINVerificationClass() TKSmartCardUserInteractionForSecurePINVerificationClass

GetTKSmartCardUserInteractionForSecurePINVerificationClass returns the class object for TKSmartCardUserInteractionForSecurePINVerification.

func (TKSmartCardUserInteractionForSecurePINVerificationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKSmartCardUserInteractionForSecurePINVerificationClass) Class

Class returns the underlying Objective-C class pointer.

type TKTLVRecord

type TKTLVRecord struct {
	objectivec.Object
}

The base class encapsulating a Tag-Length-Value record.

Overview

The CryptoTokenKit framework provides the following concrete subclasses for various TLV record encodings:

- TKBERTLVRecord for BER-TLV encoding rules - TKSimpleTLVRecord for Simple-TLV encoding according to ISO 7816-4 - TKCompactTLVRecord for Compact-TLV encoding according to ISO 7816-4

Accessing the Tag Field

Accessing the Value Field

Accessing Record Data

  • TKTLVRecord.Data: The record data, including the tag, length, and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord

func NewTKTLVRecord

func NewTKTLVRecord() TKTLVRecord

NewTKTLVRecord creates a new TKTLVRecord instance.

func NewTKTLVRecordFromData

func NewTKTLVRecordFromData(data foundation.NSData) TKTLVRecord

Creates and returns a TLV record from by parsing the specified data.

data: A data object containing the serialized representation of a TLV record.

Return Value

A TLV record, or `nil` if `data` does not specify a valid record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/init(from:)

func TKTLVRecordFromID

func TKTLVRecordFromID(id objc.ID) TKTLVRecord

TKTLVRecordFromID constructs a TKTLVRecord from an objc.ID.

The base class encapsulating a Tag-Length-Value record.

func (TKTLVRecord) Autorelease

func (t TKTLVRecord) Autorelease() TKTLVRecord

Autorelease adds the receiver to the current autorelease pool.

func (TKTLVRecord) Data

func (t TKTLVRecord) Data() foundation.NSData

The record data, including the tag, length, and value fields.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/data

func (TKTLVRecord) Init

func (t TKTLVRecord) Init() TKTLVRecord

Init initializes the instance.

func (TKTLVRecord) Tag

func (t TKTLVRecord) Tag() TKTLVTag

The tag field of the record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/tag

func (TKTLVRecord) Value

func (t TKTLVRecord) Value() foundation.NSData

The value field of the record.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/value

type TKTLVRecordClass

type TKTLVRecordClass struct {
	// contains filtered or unexported fields
}

func GetTKTLVRecordClass

func GetTKTLVRecordClass() TKTLVRecordClass

GetTKTLVRecordClass returns the class object for TKTLVRecord.

func (TKTLVRecordClass) Alloc

func (tc TKTLVRecordClass) Alloc() TKTLVRecord

Alloc allocates memory for a new instance of the class.

func (TKTLVRecordClass) Class

func (tc TKTLVRecordClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

func (TKTLVRecordClass) SequenceOfRecordsFromData

func (_TKTLVRecordClass TKTLVRecordClass) SequenceOfRecordsFromData(data foundation.NSData) []TKTLVRecord

Creates and returns an array of TLV records from the specified data.

data: A data object containing the serialized representation of zero or more TLV records.

Return Value

A sequence of TLV records, or `nil` if `data` does not specify a sequence of valid records.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVRecord/sequenceOfRecords(from:)

type TKTLVTag

type TKTLVTag = uint64

TKTLVTag is the type used to identify TLV format tags.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTLVTag

type TKToken

type TKToken struct {
	objectivec.Object
}

A representation of a hardware-based cryptographic token.

Overview

Creating Tokens

Responding to Session Creation

Accessing the Driver

Accessing Keychain Items

Configuring the Token

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken

func NewTKToken

func NewTKToken() TKToken

NewTKToken creates a new TKToken instance.

func NewTKTokenWithTokenDriverInstanceID

func NewTKTokenWithTokenDriverInstanceID(tokenDriver ITKTokenDriver, instanceID TKTokenInstanceID) TKToken

Initializes a token with the driver you specify.

tokenDriver: The driver of the token.

instanceID: A unique, persistent identifier for this token. This value is typically generated from the serial number of the target hardware.

Return Value

A new token object.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/init(tokenDriver:instanceID:)

func TKTokenFromID

func TKTokenFromID(id objc.ID) TKToken

TKTokenFromID constructs a TKToken from an objc.ID.

A representation of a hardware-based cryptographic token.

func (TKToken) Autorelease

func (t TKToken) Autorelease() TKToken

Autorelease adds the receiver to the current autorelease pool.

func (TKToken) Configuration

func (t TKToken) Configuration() ITKTokenConfiguration

The current configuration for a token.

Discussion

Access keychain items exported by this token with the methods TKTokenConfiguration.KeyForObjectIDError and TKTokenConfiguration.CertificateForObjectIDError provided by the configuration. You can access token-implementation-specific additional data using the TKTokenConfiguration.ConfigurationData property of the configuration.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/configuration-swift.property

func (TKToken) Init

func (t TKToken) Init() TKToken

Init initializes the instance.

func (TKToken) InitWithTokenDriverInstanceID

func (t TKToken) InitWithTokenDriverInstanceID(tokenDriver ITKTokenDriver, instanceID TKTokenInstanceID) TKToken

Initializes a token with the driver you specify.

tokenDriver: The driver of the token.

instanceID: A unique, persistent identifier for this token. This value is typically generated from the serial number of the target hardware.

Return Value

A new token object.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/init(tokenDriver:instanceID:)

func (TKToken) KeychainContents

func (t TKToken) KeychainContents() ITKTokenKeychainContents

The contents of the keychain for this token.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/keychainContents

func (TKToken) SetDelegate

func (t TKToken) SetDelegate(value TKTokenDelegate)

type TKTokenAuthOperation

type TKTokenAuthOperation struct {
	objectivec.Object
}

An authentication operation for a cryptographic token.

Overview

The CryptoTokenKit framework provides the following concrete subclasses: TKTokenPasswordAuthOperation, for password-based authentication, and TKTokenSmartCardPINAuthOperation for Smart Card PIN-based authentication.

Finishing the Operation

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenAuthOperation

func NewTKTokenAuthOperation

func NewTKTokenAuthOperation() TKTokenAuthOperation

NewTKTokenAuthOperation creates a new TKTokenAuthOperation instance.

func TKTokenAuthOperationFromID

func TKTokenAuthOperationFromID(id objc.ID) TKTokenAuthOperation

TKTokenAuthOperationFromID constructs a TKTokenAuthOperation from an objc.ID.

An authentication operation for a cryptographic token.

func (TKTokenAuthOperation) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenAuthOperation) EncodeWithCoder

func (t TKTokenAuthOperation) EncodeWithCoder(coder foundation.INSCoder)

func (TKTokenAuthOperation) FinishWithError

func (t TKTokenAuthOperation) FinishWithError() (bool, error)

Finishes the authentication operation.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenAuthOperation/finish()

func (TKTokenAuthOperation) Init

Init initializes the instance.

type TKTokenAuthOperationClass

type TKTokenAuthOperationClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenAuthOperationClass

func GetTKTokenAuthOperationClass() TKTokenAuthOperationClass

GetTKTokenAuthOperationClass returns the class object for TKTokenAuthOperation.

func (TKTokenAuthOperationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenAuthOperationClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenClass

type TKTokenClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenClass

func GetTKTokenClass() TKTokenClass

GetTKTokenClass returns the class object for TKToken.

func (TKTokenClass) Alloc

func (tc TKTokenClass) Alloc() TKToken

Alloc allocates memory for a new instance of the class.

func (TKTokenClass) Class

func (tc TKTokenClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenConfiguration

type TKTokenConfiguration struct {
	objectivec.Object
}

A token’s configuration.

Overview

When you introduce a new TKTokenConfiguration into the system, it can inform the system about its identities, consisting of both private keys and certificates, which the TKTokenConfiguration.KeychainItems property provides. Use the TKTokenConfiguration.ConfigurationData property to set additional configuration data.

You configure always-available tokens on a per-user basis. Although the token driver and the app hosting the token extension are shared across the system, the configuration for a token is stored individually for each user.

Reporting Configuration Information

Retrieving Keys and Certificates

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class

func NewTKTokenConfiguration

func NewTKTokenConfiguration() TKTokenConfiguration

NewTKTokenConfiguration creates a new TKTokenConfiguration instance.

func TKTokenConfigurationFromID

func TKTokenConfigurationFromID(id objc.ID) TKTokenConfiguration

TKTokenConfigurationFromID constructs a TKTokenConfiguration from an objc.ID.

A token’s configuration.

func (TKTokenConfiguration) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenConfiguration) CertificateForObjectIDError

func (t TKTokenConfiguration) CertificateForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainCertificate, error)

Returns a certificate from the keychain with the object identifier you specify.

objectID: The identifier for the certificate within the keychain.

Return Value

The certificate that the keychain stores.

Discussion

If the certificate the `objectID` specifies isn’t found, the system fills `error` with TKError.Code.objectNotFound.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/certificate(for:)

func (TKTokenConfiguration) ConfigurationData

func (t TKTokenConfiguration) ConfigurationData() foundation.NSData

Additional configuration information for the token instance.

Discussion

TKTokenConfiguration.ConfigurationData can provide token-implementation-specific additional data, which the app that hosts the token driver extension and configures the token provides. The system doesn’t interpret this data in any way.

For example, the network-based hardware security module (HSM) can store encoded target network addresses, access credentials, or the list of identities the HSM contains.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/configurationData

func (TKTokenConfiguration) Init

Init initializes the instance.

func (TKTokenConfiguration) InstanceID

func (t TKTokenConfiguration) InstanceID() TKTokenInstanceID

The unique, persistent identifier of this token that the token implementation creates.

Discussion

The instance identifier often represents some kind of serial number of the target hardware.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/instanceID

func (TKTokenConfiguration) KeyForObjectIDError

func (t TKTokenConfiguration) KeyForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainKey, error)

Returns a key from the keychain with the object identifier you specify.

objectID: The identifier for the key within the keychain.

Return Value

The key that the keychain stores.

Discussion

If the key the `objectID` specifies isn’t found, the system fills the `error` with TKError.Code.objectNotFound.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/key(for:)

func (TKTokenConfiguration) KeychainItems

func (t TKTokenConfiguration) KeychainItems() []TKTokenKeychainItem

The keychain items associated with this token.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/Configuration-swift.class/keychainItems

func (TKTokenConfiguration) SetConfigurationData

func (t TKTokenConfiguration) SetConfigurationData(value foundation.NSData)

func (TKTokenConfiguration) SetKeychainItems

func (t TKTokenConfiguration) SetKeychainItems(value []TKTokenKeychainItem)

type TKTokenConfigurationClass

type TKTokenConfigurationClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenConfigurationClass

func GetTKTokenConfigurationClass() TKTokenConfigurationClass

GetTKTokenConfigurationClass returns the class object for TKTokenConfiguration.

func (TKTokenConfigurationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenConfigurationClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenDelegate

type TKTokenDelegate interface {
	objectivec.IObject

	// Tells the delegate to create a session for the specified token.
	//
	// See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDelegate/createSession(_:)
	TokenCreateSessionWithError(token ITKToken) (ITKTokenSession, error)
}

The interface that a token delegate implements to respond to session creation events.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDelegate

type TKTokenDelegateConfig

type TKTokenDelegateConfig struct {

	// Delegate Methods
	// TokenTerminateSession — Tells the delegate to terminate the specified token session.
	TokenTerminateSession func(token TKToken, session TKTokenSession)

	// Other Methods
	// TokenCreateSessionWithError — Tells the delegate to create a session for the specified token.
	TokenCreateSessionWithError func(token TKToken, error_ foundation.NSError) TKTokenSession
}

TKTokenDelegateConfig holds optional typed callbacks for TKTokenDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type TKTokenDelegateObject

type TKTokenDelegateObject struct {
	objectivec.Object
}

TKTokenDelegateObject wraps an existing Objective-C object that conforms to the TKTokenDelegate protocol.

func NewTKTokenDelegate

func NewTKTokenDelegate(config TKTokenDelegateConfig) TKTokenDelegateObject

NewTKTokenDelegate creates an Objective-C object implementing the TKTokenDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned TKTokenDelegateObject satisfies the TKTokenDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func TKTokenDelegateObjectFromID

func TKTokenDelegateObjectFromID(id objc.ID) TKTokenDelegateObject

TKTokenDelegateObjectFromID constructs a TKTokenDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (TKTokenDelegateObject) BaseObject

func (o TKTokenDelegateObject) BaseObject() objectivec.Object

func (TKTokenDelegateObject) TokenCreateSessionWithError

func (o TKTokenDelegateObject) TokenCreateSessionWithError(token ITKToken) (ITKTokenSession, error)

Tells the delegate to create a session for the specified token.

token: The token.

Return Value

A new token session, or `nil` if an error occurred.

Discussion

All operations for a token are performed within a session representing an authentication context. This delegate method is called whenever new authentication context is needed. For example, a client may want to perform a token operation using a keychain object that has an associated [LAContext].

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDelegate/createSession(_:)

func (TKTokenDelegateObject) TokenTerminateSession

func (o TKTokenDelegateObject) TokenTerminateSession(token ITKToken, session ITKTokenSession)

Tells the delegate to terminate the specified token session.

token: The token.

session: The token session to be terminated.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDelegate/token(_:terminateSession:)

type TKTokenDriver

type TKTokenDriver struct {
	objectivec.Object
}

A base class for building token drivers.

Overview

When using the TKTokenDriver class, implement the TKTokenDriverDelegate protocol with the [TokenDriverTokenForConfigurationError] method, which the system invokes when it requests the creation of a token instance. After you create the token driver, it can examine TKTokenConfiguration.KeychainItems and TKTokenConfiguration.ConfigurationData to implement your desired functionality.

An implementation can also access its associated token configuration using the TKTokenConfiguration property.

Responding to Token Creation

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver

func NewTKTokenDriver

func NewTKTokenDriver() TKTokenDriver

NewTKTokenDriver creates a new TKTokenDriver instance.

func TKTokenDriverFromID

func TKTokenDriverFromID(id objc.ID) TKTokenDriver

TKTokenDriverFromID constructs a TKTokenDriver from an objc.ID.

A base class for building token drivers.

func (TKTokenDriver) Autorelease

func (t TKTokenDriver) Autorelease() TKTokenDriver

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenDriver) Init

func (t TKTokenDriver) Init() TKTokenDriver

Init initializes the instance.

func (TKTokenDriver) SetDelegate

func (t TKTokenDriver) SetDelegate(value TKTokenDriverDelegate)

type TKTokenDriverClass

type TKTokenDriverClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenDriverClass

func GetTKTokenDriverClass() TKTokenDriverClass

GetTKTokenDriverClass returns the class object for TKTokenDriver.

func (TKTokenDriverClass) Alloc

func (tc TKTokenDriverClass) Alloc() TKTokenDriver

Alloc allocates memory for a new instance of the class.

func (TKTokenDriverClass) Class

func (tc TKTokenDriverClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenDriverClassID

type TKTokenDriverClassID = string

TKTokenDriverClassID is the type of the class identifier for the token driver.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/ClassID

type TKTokenDriverConfiguration

type TKTokenDriverConfiguration struct {
	objectivec.Object
}

A configuration for one class of token.

Reporting Configuration Information

Adding and Removing Configurations

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration

func NewTKTokenDriverConfiguration

func NewTKTokenDriverConfiguration() TKTokenDriverConfiguration

NewTKTokenDriverConfiguration creates a new TKTokenDriverConfiguration instance.

func TKTokenDriverConfigurationFromID

func TKTokenDriverConfigurationFromID(id objc.ID) TKTokenDriverConfiguration

TKTokenDriverConfigurationFromID constructs a TKTokenDriverConfiguration from an objc.ID.

A configuration for one class of token.

func (TKTokenDriverConfiguration) AddTokenConfigurationForTokenInstanceID

func (t TKTokenDriverConfiguration) AddTokenConfigurationForTokenInstanceID(instanceID TKTokenInstanceID) ITKTokenConfiguration

Creates a configuration object for a token with the token instance identifier you specify.

instanceID: The token’s instance identifier.

Return Value

The configuration class for the token.

Discussion

This method adds the created configuration into the TKTokenDriverConfiguration.TokenConfigurations dictionary. Adding a configuration with an `instanceID` that already exists replaces the existing configuration with a new empty configuration.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration/addTokenConfiguration(for:)

func (TKTokenDriverConfiguration) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenDriverConfiguration) ClassID

The class identifier of the token driver.

Discussion

The identifier uses a reverse-DNS format, such as `com.ExampleXCUIElementTypeId()`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration/classID

func (TKTokenDriverConfiguration) Init

Init initializes the instance.

func (TKTokenDriverConfiguration) RemoveTokenConfigurationForTokenInstanceID

func (t TKTokenDriverConfiguration) RemoveTokenConfigurationForTokenInstanceID(instanceID TKTokenInstanceID)

Removes a configuration for a token with the token instance identifier you specify.

instanceID: The token’s instance identifier.

Discussion

The method does nothing if the token configuration you specify doesn’t exist.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration/removeTokenConfiguration(for:)

func (TKTokenDriverConfiguration) TokenConfigurations

func (t TKTokenDriverConfiguration) TokenConfigurations() foundation.INSDictionary

A dictionary of all currently configured tokens for this token class, which the token instance identifier keys.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration/tokenConfigurations

type TKTokenDriverConfigurationClass

type TKTokenDriverConfigurationClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenDriverConfigurationClass

func GetTKTokenDriverConfigurationClass() TKTokenDriverConfigurationClass

GetTKTokenDriverConfigurationClass returns the class object for TKTokenDriverConfiguration.

func (TKTokenDriverConfigurationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenDriverConfigurationClass) Class

Class returns the underlying Objective-C class pointer.

func (TKTokenDriverConfigurationClass) DriverConfigurations

func (_TKTokenDriverConfigurationClass TKTokenDriverConfigurationClass) DriverConfigurations() foundation.INSDictionary

A dictionary of token class configurations which the class identifier of the token driver keys.

Discussion

If the app hosting the token extension calls this method, it returns a list of configurations for hosted token extensions. Otherwise, this method returns an empty array.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriver/Configuration/driverConfigurations

type TKTokenDriverDelegate

type TKTokenDriverDelegate interface {
	objectivec.IObject
}

The interface that a token driver delegate implements to respond to token creation events.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriverDelegate

type TKTokenDriverDelegateConfig

type TKTokenDriverDelegateConfig struct {

	// Creating and Removing Tokens
	// TokenDriverTerminateToken — Tells the delegate to terminate the token you specify.
	TokenDriverTerminateToken func(driver TKTokenDriver, token TKToken)

	// Other Methods
	// TokenDriverTokenForConfigurationError — Creates a new token for the configuration you specify.
	TokenDriverTokenForConfigurationError func(driver TKTokenDriver, configuration TKTokenConfiguration, error_ foundation.NSError) TKToken
}

TKTokenDriverDelegateConfig holds optional typed callbacks for TKTokenDriverDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type TKTokenDriverDelegateObject

type TKTokenDriverDelegateObject struct {
	objectivec.Object
}

TKTokenDriverDelegateObject wraps an existing Objective-C object that conforms to the TKTokenDriverDelegate protocol.

func NewTKTokenDriverDelegate

func NewTKTokenDriverDelegate(config TKTokenDriverDelegateConfig) TKTokenDriverDelegateObject

NewTKTokenDriverDelegate creates an Objective-C object implementing the TKTokenDriverDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned TKTokenDriverDelegateObject satisfies the TKTokenDriverDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func TKTokenDriverDelegateObjectFromID

func TKTokenDriverDelegateObjectFromID(id objc.ID) TKTokenDriverDelegateObject

TKTokenDriverDelegateObjectFromID constructs a TKTokenDriverDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (TKTokenDriverDelegateObject) BaseObject

func (TKTokenDriverDelegateObject) TokenDriverTerminateToken

func (o TKTokenDriverDelegateObject) TokenDriverTerminateToken(driver ITKTokenDriver, token ITKToken)

Tells the delegate to terminate the token you specify.

driver: The token driver.

token: The token to be terminated.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriverDelegate/tokenDriver(_:terminateToken:)

func (TKTokenDriverDelegateObject) TokenDriverTokenForConfigurationError

func (o TKTokenDriverDelegateObject) TokenDriverTokenForConfigurationError(driver ITKTokenDriver, configuration ITKTokenConfiguration) (ITKToken, error)

Creates a new token for the configuration you specify.

driver: The token driver.

configuration: The configuration that identifies the token to create.

Return Value

The created token.

Discussion

The system invokes this method to request creation of a token instance, which the TKTokenConfiguration.InstanceID property of the configuration you specify identifies.

The created token has access to its current configuration using the TKTokenConfiguration.ConfigurationData property, which can provide token-implementation-specific additional data. The token can access keychain items this token exports with the methods TKTokenConfiguration.KeyForObjectIDError and TKTokenConfiguration.CertificateForObjectIDError that the configuration provides.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenDriverDelegate/tokenDriver(_:tokenFor:)

type TKTokenInstanceID

type TKTokenInstanceID = string

TKTokenInstanceID is a type that represents the instance identifier of a token.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/InstanceID

type TKTokenKeyAlgorithm

type TKTokenKeyAlgorithm struct {
	objectivec.Object
}

Cryptographic algorithms used by token keys.

Overview

Typically, the supported algorithm for a token key can be represented by a value of the [SecKeyAlgorithm] enumeration. However, tokens such as Smart Cards require that input data for operations take the format of a more specific algorithm. For example, a token may accept raw data to generate a cryptographic signature, but require that raw data to be formatted according to PKCS1 padding rules. To express such a requirement, a TKTokenKeyAlgorithm object defines a target algorithm and a set of other algorithms that were used. In the previous example, the target algorithm is `kSecKeyAlgorithmRSASignatureRaw` and the `kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA1` algorithm is also reported as being used.

Determining Algorithm Usage

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyAlgorithm

func NewTKTokenKeyAlgorithm

func NewTKTokenKeyAlgorithm() TKTokenKeyAlgorithm

NewTKTokenKeyAlgorithm creates a new TKTokenKeyAlgorithm instance.

func TKTokenKeyAlgorithmFromID

func TKTokenKeyAlgorithmFromID(id objc.ID) TKTokenKeyAlgorithm

TKTokenKeyAlgorithmFromID constructs a TKTokenKeyAlgorithm from an objc.ID.

Cryptographic algorithms used by token keys.

func (TKTokenKeyAlgorithm) Autorelease

func (t TKTokenKeyAlgorithm) Autorelease() TKTokenKeyAlgorithm

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeyAlgorithm) Init

Init initializes the instance.

func (TKTokenKeyAlgorithm) IsAlgorithm

func (t TKTokenKeyAlgorithm) IsAlgorithm(algorithm corefoundation.CFStringRef) bool

Returns whether the specified algorithm is the target operation algorithm.

algorithm: The algorithm to be checked.

Return Value

true if `algorithm` is the target operation algorithm; otherwise, false.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyAlgorithm/isAlgorithm(_:)

func (TKTokenKeyAlgorithm) SupportsAlgorithm

func (t TKTokenKeyAlgorithm) SupportsAlgorithm(algorithm corefoundation.CFStringRef) bool

Whether the specified algorithm is the target operation algorithm, or one of the other algorithms used.

algorithm: The algorithm to be checked.

Return Value

true if `algorithm` is the target operation algorithm or one of the other algorithms used; otherwise, false.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyAlgorithm/supportsAlgorithm(_:)

type TKTokenKeyAlgorithmClass

type TKTokenKeyAlgorithmClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeyAlgorithmClass

func GetTKTokenKeyAlgorithmClass() TKTokenKeyAlgorithmClass

GetTKTokenKeyAlgorithmClass returns the class object for TKTokenKeyAlgorithm.

func (TKTokenKeyAlgorithmClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeyAlgorithmClass) Class

func (tc TKTokenKeyAlgorithmClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenKeyExchangeParameters

type TKTokenKeyExchangeParameters struct {
	objectivec.Object
}

Parameters used to perform specific key exchange operations.

Accessing Parameters

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyExchangeParameters

func NewTKTokenKeyExchangeParameters

func NewTKTokenKeyExchangeParameters() TKTokenKeyExchangeParameters

NewTKTokenKeyExchangeParameters creates a new TKTokenKeyExchangeParameters instance.

func TKTokenKeyExchangeParametersFromID

func TKTokenKeyExchangeParametersFromID(id objc.ID) TKTokenKeyExchangeParameters

TKTokenKeyExchangeParametersFromID constructs a TKTokenKeyExchangeParameters from an objc.ID.

Parameters used to perform specific key exchange operations.

func (TKTokenKeyExchangeParameters) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeyExchangeParameters) Init

Init initializes the instance.

func (TKTokenKeyExchangeParameters) RequestedSize

func (t TKTokenKeyExchangeParameters) RequestedSize() int

Returns the requested output size, in bytes, of key exchange result.

Discussion

This property should be ignored if the output size is not configurable for the specified key exchange algorithm.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyExchangeParameters/requestedSize

func (TKTokenKeyExchangeParameters) SharedInfo

Returns shared information typically used during the key derivation (KDF) step of a key exchange algorithm.

Discussion

This property should be ignored if shared information isn’t used by the specified key exchange algorithm.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeyExchangeParameters/sharedInfo

type TKTokenKeyExchangeParametersClass

type TKTokenKeyExchangeParametersClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeyExchangeParametersClass

func GetTKTokenKeyExchangeParametersClass() TKTokenKeyExchangeParametersClass

GetTKTokenKeyExchangeParametersClass returns the class object for TKTokenKeyExchangeParameters.

func (TKTokenKeyExchangeParametersClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeyExchangeParametersClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenKeychainCertificate

type TKTokenKeychainCertificate struct {
	TKTokenKeychainItem
}

A token’s certificate as stored in the keychain.

Creating Token Keychain Certificates

Accessing Certificate Data

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainCertificate

func NewTKTokenKeychainCertificate

func NewTKTokenKeychainCertificate() TKTokenKeychainCertificate

NewTKTokenKeychainCertificate creates a new TKTokenKeychainCertificate instance.

func NewTKTokenKeychainCertificateWithCertificateObjectID

func NewTKTokenKeychainCertificateWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainCertificate

Initializes a token keychain certificate with data from the specified certificate reference and a given object ID.

certificateRef: The certificate reference.

You can create a SecCertificate value from a data object using the SecCertificateCreateWithData(_:_:) function.

objectID: The object ID.

Return Value

A new token keychain certificate.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainCertificate/init(certificate:objectID:)

func NewTKTokenKeychainCertificateWithObjectID

func NewTKTokenKeychainCertificateWithObjectID(objectID TKTokenObjectID) TKTokenKeychainCertificate

Initializes a token keychain item with the specified object ID.

objectID: The object ID.

Return Value

A new keychain item.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/init(objectID:)

func TKTokenKeychainCertificateFromID

func TKTokenKeychainCertificateFromID(id objc.ID) TKTokenKeychainCertificate

TKTokenKeychainCertificateFromID constructs a TKTokenKeychainCertificate from an objc.ID.

A token’s certificate as stored in the keychain.

func (TKTokenKeychainCertificate) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeychainCertificate) Data

Returns a DER-encoded representation of an X.509 certificate.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainCertificate/data

func (TKTokenKeychainCertificate) Init

Init initializes the instance.

func (TKTokenKeychainCertificate) InitWithCertificateObjectID

func (t TKTokenKeychainCertificate) InitWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainCertificate

Initializes a token keychain certificate with data from the specified certificate reference and a given object ID.

certificateRef: The certificate reference.

You can create a SecCertificate value from a data object using the SecCertificateCreateWithData(_:_:) function.

objectID: The object ID.

Return Value

A new token keychain certificate.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainCertificate/init(certificate:objectID:)

type TKTokenKeychainCertificateClass

type TKTokenKeychainCertificateClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeychainCertificateClass

func GetTKTokenKeychainCertificateClass() TKTokenKeychainCertificateClass

GetTKTokenKeychainCertificateClass returns the class object for TKTokenKeychainCertificate.

func (TKTokenKeychainCertificateClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeychainCertificateClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenKeychainContents

type TKTokenKeychainContents struct {
	objectivec.Object
}

A representation of the state of the keychain for a particular token.

Adding Keychain Items

Accessing Keychain Items

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents

func NewTKTokenKeychainContents

func NewTKTokenKeychainContents() TKTokenKeychainContents

NewTKTokenKeychainContents creates a new TKTokenKeychainContents instance.

func TKTokenKeychainContentsFromID

func TKTokenKeychainContentsFromID(id objc.ID) TKTokenKeychainContents

TKTokenKeychainContentsFromID constructs a TKTokenKeychainContents from an objc.ID.

A representation of the state of the keychain for a particular token.

func (TKTokenKeychainContents) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeychainContents) CertificateForObjectIDError

func (t TKTokenKeychainContents) CertificateForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainCertificate, error)

Returns the key for a specified object identifier.

objectID: The object identifier for the keychain item.

Return Value

The certificate, or `nil` if no certificate exists.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents/certificate(forObjectID:)

func (TKTokenKeychainContents) FillWithItems

func (t TKTokenKeychainContents) FillWithItems(items []TKTokenKeychainItem)

Fills the keychain with the specified items.

items: The items to be added to the keychain.

Discussion

All existing items for the token are first removed from the keychain before filling the keychain with `items`.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents/fill(with:)

func (TKTokenKeychainContents) Init

Init initializes the instance.

func (TKTokenKeychainContents) Items

Returns all items for token in the keychain.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents/items

func (TKTokenKeychainContents) KeyForObjectIDError

func (t TKTokenKeychainContents) KeyForObjectIDError(objectID TKTokenObjectID) (ITKTokenKeychainKey, error)

Returns the key for a specified object identifier.

objectID: The object identifier for the keychain item.

Return Value

The key, or `nil` if no key exists.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainContents/key(forObjectID:)

type TKTokenKeychainContentsClass

type TKTokenKeychainContentsClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeychainContentsClass

func GetTKTokenKeychainContentsClass() TKTokenKeychainContentsClass

GetTKTokenKeychainContentsClass returns the class object for TKTokenKeychainContents.

func (TKTokenKeychainContentsClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeychainContentsClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenKeychainItem

type TKTokenKeychainItem struct {
	objectivec.Object
}

An abstract base class for managing a token’s contents as keychain items.

Overview

Don’t use this base class directly. Instead, use one of its subclasses, such as TKTokenKeychainCertificate for managing certificates or TKTokenKeychainKey for managing cryptographic keys.

Creating Token Keychain Items

Accessing Keychain Item Attributes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem

func NewTKTokenKeychainItem

func NewTKTokenKeychainItem() TKTokenKeychainItem

NewTKTokenKeychainItem creates a new TKTokenKeychainItem instance.

func NewTKTokenKeychainItemWithObjectID

func NewTKTokenKeychainItemWithObjectID(objectID TKTokenObjectID) TKTokenKeychainItem

Initializes a token keychain item with the specified object ID.

objectID: The object ID.

Return Value

A new keychain item.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/init(objectID:)

func TKTokenKeychainItemFromID

func TKTokenKeychainItemFromID(id objc.ID) TKTokenKeychainItem

TKTokenKeychainItemFromID constructs a TKTokenKeychainItem from an objc.ID.

An abstract base class for managing a token’s contents as keychain items.

func (TKTokenKeychainItem) Autorelease

func (t TKTokenKeychainItem) Autorelease() TKTokenKeychainItem

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeychainItem) Constraints

Access constraints for the keychain item, keyed by TKTokenOperation values wrapped in NSNumber objects.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/constraints

func (TKTokenKeychainItem) Init

Init initializes the instance.

func (TKTokenKeychainItem) InitWithObjectID

func (t TKTokenKeychainItem) InitWithObjectID(objectID TKTokenObjectID) TKTokenKeychainItem

Initializes a token keychain item with the specified object ID.

objectID: The object ID.

Return Value

A new keychain item.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/init(objectID:)

func (TKTokenKeychainItem) Label

func (t TKTokenKeychainItem) Label() string

The user-visible label for the keychain item.

Discussion

This property is equivalent to the `kSecAttrLabel` attribute type.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/label

func (TKTokenKeychainItem) ObjectID

func (t TKTokenKeychainItem) ObjectID() TKTokenObjectID

Returns the object ID used for keychain item identification.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/objectID

func (TKTokenKeychainItem) SetConstraints

func (t TKTokenKeychainItem) SetConstraints(value foundation.INSDictionary)

func (TKTokenKeychainItem) SetLabel

func (t TKTokenKeychainItem) SetLabel(value string)

type TKTokenKeychainItemClass

type TKTokenKeychainItemClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeychainItemClass

func GetTKTokenKeychainItemClass() TKTokenKeychainItemClass

GetTKTokenKeychainItemClass returns the class object for TKTokenKeychainItem.

func (TKTokenKeychainItemClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeychainItemClass) Class

func (tc TKTokenKeychainItemClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenKeychainKey

type TKTokenKeychainKey struct {
	TKTokenKeychainItem
}

A token’s key as stored in the keychain.

Creating Token Keychain Keys

Accessing Key Attributes

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey

func NewTKTokenKeychainKey

func NewTKTokenKeychainKey() TKTokenKeychainKey

NewTKTokenKeychainKey creates a new TKTokenKeychainKey instance.

func NewTKTokenKeychainKeyWithCertificateObjectID

func NewTKTokenKeychainKeyWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainKey

Initializes a token keychain key with data from the specified certificate reference and a given object ID.

certificateRef: The certificate reference.

You can create a [SecCertificateRef] value from a data object using the [SecCertificateCreateWithData] function.

objectID: The object ID.

Return Value

A new token keychain certificate.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/init(certificate:objectID:)

func NewTKTokenKeychainKeyWithObjectID

func NewTKTokenKeychainKeyWithObjectID(objectID TKTokenObjectID) TKTokenKeychainKey

Initializes a token keychain item with the specified object ID.

objectID: The object ID.

Return Value

A new keychain item.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainItem/init(objectID:)

func TKTokenKeychainKeyFromID

func TKTokenKeychainKeyFromID(id objc.ID) TKTokenKeychainKey

TKTokenKeychainKeyFromID constructs a TKTokenKeychainKey from an objc.ID.

A token’s key as stored in the keychain.

func (TKTokenKeychainKey) ApplicationTag

func (t TKTokenKeychainKey) ApplicationTag() foundation.NSData

The private tag data.

Discussion

This property is equivalent to the `kSecAttrApplicationTag` type attribute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/applicationTag

func (TKTokenKeychainKey) Autorelease

func (t TKTokenKeychainKey) Autorelease() TKTokenKeychainKey

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenKeychainKey) CanDecrypt

func (t TKTokenKeychainKey) CanDecrypt() bool

Whether the key can be used to decrypt data.

Discussion

This property is equivalent to the `kSecAttrCanDecrypt` type attribute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/canDecrypt

func (TKTokenKeychainKey) CanPerformKeyExchange

func (t TKTokenKeychainKey) CanPerformKeyExchange() bool

Whether the key can be used to perform Diffie-Hellman style cryptographic key exchange.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/canPerformKeyExchange

func (TKTokenKeychainKey) CanSign

func (t TKTokenKeychainKey) CanSign() bool

Whether the key can be used to sign data.

Discussion

This property is equivalent to the `kSecAttrCanSign` type attribute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/canSign

func (TKTokenKeychainKey) Init

Init initializes the instance.

func (TKTokenKeychainKey) InitWithCertificateObjectID

func (t TKTokenKeychainKey) InitWithCertificateObjectID(certificateRef security.SecCertificateRef, objectID TKTokenObjectID) TKTokenKeychainKey

Initializes a token keychain key with data from the specified certificate reference and a given object ID.

certificateRef: The certificate reference.

You can create a [SecCertificateRef] value from a data object using the [SecCertificateCreateWithData] function.

objectID: The object ID.

Return Value

A new token keychain certificate.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/init(certificate:objectID:)

func (TKTokenKeychainKey) IsSuitableForLogin

func (t TKTokenKeychainKey) IsSuitableForLogin() bool

Whether the key can be used for system login.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/isSuitableForLogin

func (TKTokenKeychainKey) KeyType

func (t TKTokenKeychainKey) KeyType() string

The type of the key. Currently, only kSecAttrKeyTypeRSA and `kSecAttrKeyTypeECSECPrimeRandom` are supported values.

Discussion

This property is equivalent to the `kSecAttrKeyType` type attribute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/keyType

func (TKTokenKeychainKey) PublicKeyHash

func (t TKTokenKeychainKey) PublicKeyHash() foundation.NSData

The SHA1 hash of the raw public key.

Discussion

This property is equivalent to the `kSecAttrApplicationLabel` type attribute.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenKeychainKey/publicKeyHash

func (TKTokenKeychainKey) SetApplicationTag

func (t TKTokenKeychainKey) SetApplicationTag(value foundation.NSData)

func (TKTokenKeychainKey) SetCanDecrypt

func (t TKTokenKeychainKey) SetCanDecrypt(value bool)

func (TKTokenKeychainKey) SetCanPerformKeyExchange

func (t TKTokenKeychainKey) SetCanPerformKeyExchange(value bool)

func (TKTokenKeychainKey) SetCanSign

func (t TKTokenKeychainKey) SetCanSign(value bool)

func (TKTokenKeychainKey) SetKeySizeInBits

func (t TKTokenKeychainKey) SetKeySizeInBits(value int)

func (TKTokenKeychainKey) SetKeyType

func (t TKTokenKeychainKey) SetKeyType(value string)

func (TKTokenKeychainKey) SetPublicKeyData

func (t TKTokenKeychainKey) SetPublicKeyData(value foundation.NSData)

func (TKTokenKeychainKey) SetPublicKeyHash

func (t TKTokenKeychainKey) SetPublicKeyHash(value foundation.NSData)

func (TKTokenKeychainKey) SetSuitableForLogin

func (t TKTokenKeychainKey) SetSuitableForLogin(value bool)

type TKTokenKeychainKeyClass

type TKTokenKeychainKeyClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenKeychainKeyClass

func GetTKTokenKeychainKeyClass() TKTokenKeychainKeyClass

GetTKTokenKeychainKeyClass returns the class object for TKTokenKeychainKey.

func (TKTokenKeychainKeyClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenKeychainKeyClass) Class

func (tc TKTokenKeychainKeyClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenObjectID

type TKTokenObjectID = objectivec.Object

TKTokenObjectID is a unique and persistent identifier of a particular token object.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKToken/ObjectID

type TKTokenOperation

type TKTokenOperation int

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenOperation

const (
	TKTokenOperationDecryptData        TKTokenOperation = 3
	TKTokenOperationNone               TKTokenOperation = 0
	TKTokenOperationPerformKeyExchange TKTokenOperation = 4
	TKTokenOperationReadData           TKTokenOperation = 1
	TKTokenOperationSignData           TKTokenOperation = 2
)

func (TKTokenOperation) String

func (e TKTokenOperation) String() string

type TKTokenOperationConstraint

type TKTokenOperationConstraint = objectivec.Object

TKTokenOperationConstraint is a token’s authentication constraint for a specific operation.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenOperationConstraint

type TKTokenPasswordAuthOperation

type TKTokenPasswordAuthOperation struct {
	TKTokenAuthOperation
}

A password-based authentication operation.

Managing the Password

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenPasswordAuthOperation

func NewTKTokenPasswordAuthOperation

func NewTKTokenPasswordAuthOperation() TKTokenPasswordAuthOperation

NewTKTokenPasswordAuthOperation creates a new TKTokenPasswordAuthOperation instance.

func TKTokenPasswordAuthOperationFromID

func TKTokenPasswordAuthOperationFromID(id objc.ID) TKTokenPasswordAuthOperation

TKTokenPasswordAuthOperationFromID constructs a TKTokenPasswordAuthOperation from an objc.ID.

A password-based authentication operation.

func (TKTokenPasswordAuthOperation) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenPasswordAuthOperation) Init

Init initializes the instance.

func (TKTokenPasswordAuthOperation) Password

func (t TKTokenPasswordAuthOperation) Password() string

The password to be filled in when the “ is called.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenPasswordAuthOperation/password

func (TKTokenPasswordAuthOperation) SetPassword

func (t TKTokenPasswordAuthOperation) SetPassword(value string)

type TKTokenPasswordAuthOperationClass

type TKTokenPasswordAuthOperationClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenPasswordAuthOperationClass

func GetTKTokenPasswordAuthOperationClass() TKTokenPasswordAuthOperationClass

GetTKTokenPasswordAuthOperationClass returns the class object for TKTokenPasswordAuthOperation.

func (TKTokenPasswordAuthOperationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenPasswordAuthOperationClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenSession

type TKTokenSession struct {
	objectivec.Object
}

A token session that manages the authentication state of a token.

Overview

A token session communicates with its delegate to perform operations with its token that are bound to the authentication state.

A session is always instantiated by a TKToken instance through the token’s delegate when the framework detects access to the token from a new authentication session.

Creating Token Sessions

Responding to Authentication Events

Accessing the Token

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession

func NewTKTokenSession

func NewTKTokenSession() TKTokenSession

NewTKTokenSession creates a new TKTokenSession instance.

func NewTKTokenSessionWithToken

func NewTKTokenSessionWithToken(token ITKToken) TKTokenSession

Initializes a token session with the specified token.

token: The token to which the initialized session is bound.

Return Value

A new token session created with the specified token.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession/init(token:)

func TKTokenSessionFromID

func TKTokenSessionFromID(id objc.ID) TKTokenSession

TKTokenSessionFromID constructs a TKTokenSession from an objc.ID.

A token session that manages the authentication state of a token.

func (TKTokenSession) Autorelease

func (t TKTokenSession) Autorelease() TKTokenSession

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenSession) Init

func (t TKTokenSession) Init() TKTokenSession

Init initializes the instance.

func (TKTokenSession) InitWithToken

func (t TKTokenSession) InitWithToken(token ITKToken) TKTokenSession

Initializes a token session with the specified token.

token: The token to which the initialized session is bound.

Return Value

A new token session created with the specified token.

Discussion

This is the designated initializer.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession/init(token:)

func (TKTokenSession) SetDelegate

func (t TKTokenSession) SetDelegate(value TKTokenSessionDelegate)

func (TKTokenSession) Token

func (t TKTokenSession) Token() ITKToken

The token to which the session is bound.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSession/token

type TKTokenSessionClass

type TKTokenSessionClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenSessionClass

func GetTKTokenSessionClass() TKTokenSessionClass

GetTKTokenSessionClass returns the class object for TKTokenSession.

func (TKTokenSessionClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenSessionClass) Class

func (tc TKTokenSessionClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenSessionDelegate

type TKTokenSessionDelegate interface {
	objectivec.IObject
}

The interface that a session instance delegate implements to respond to token session authentication events.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate

type TKTokenSessionDelegateConfig

type TKTokenSessionDelegateConfig struct {

	// Other Methods
	// TokenSessionSupportsOperationUsingKeyAlgorithm — Asks the delegate whether the token session supports a given operation using the specified key and algorithm.
	TokenSessionSupportsOperationUsingKeyAlgorithm func(session TKTokenSession, operation TKTokenOperation, keyObjectID TKTokenObjectID, algorithm TKTokenKeyAlgorithm) bool
	// TokenSessionBeginAuthForOperationConstraintError — Tells the delegate that authentication has begun for the specified operation and constraint.
	TokenSessionBeginAuthForOperationConstraintError func(session TKTokenSession, operation TKTokenOperation, constraint TKTokenOperationConstraint, error_ foundation.NSError) TKTokenAuthOperation
	// TokenSessionSignDataUsingKeyAlgorithmError — Tells the delegate to sign a data object using the specified key and algorithm.
	TokenSessionSignDataUsingKeyAlgorithmError func(session TKTokenSession, dataToSign foundation.NSData, keyObjectID TKTokenObjectID, algorithm TKTokenKeyAlgorithm, error_ foundation.NSError) foundation.NSData
	// TokenSessionDecryptDataUsingKeyAlgorithmError — Tells the delegate to decrypt a data object using the specified key and algorithm.
	TokenSessionDecryptDataUsingKeyAlgorithmError func(session TKTokenSession, ciphertext foundation.NSData, keyObjectID TKTokenObjectID, algorithm TKTokenKeyAlgorithm, error_ foundation.NSError) foundation.NSData
	// TokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError — Tells the delegate to perform a key exchange using the specified key and algorithm.
	TokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError func(session TKTokenSession, otherPartyPublicKeyData foundation.NSData, objectID TKTokenObjectID, algorithm TKTokenKeyAlgorithm, parameters TKTokenKeyExchangeParameters, error_ foundation.NSError) foundation.NSData
}

TKTokenSessionDelegateConfig holds optional typed callbacks for TKTokenSessionDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.

See Apple Documentation for protocol details.

type TKTokenSessionDelegateObject

type TKTokenSessionDelegateObject struct {
	objectivec.Object
}

TKTokenSessionDelegateObject wraps an existing Objective-C object that conforms to the TKTokenSessionDelegate protocol.

func NewTKTokenSessionDelegate

func NewTKTokenSessionDelegate(config TKTokenSessionDelegateConfig) TKTokenSessionDelegateObject

NewTKTokenSessionDelegate creates an Objective-C object implementing the TKTokenSessionDelegate protocol.

Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.

The returned TKTokenSessionDelegateObject satisfies the TKTokenSessionDelegate interface and can be passed directly to SetDelegate and similar methods.

See Apple Documentation for protocol details.

func TKTokenSessionDelegateObjectFromID

func TKTokenSessionDelegateObjectFromID(id objc.ID) TKTokenSessionDelegateObject

TKTokenSessionDelegateObjectFromID constructs a TKTokenSessionDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (TKTokenSessionDelegateObject) BaseObject

func (TKTokenSessionDelegateObject) TokenSessionBeginAuthForOperationConstraintError

func (o TKTokenSessionDelegateObject) TokenSessionBeginAuthForOperationConstraintError(session ITKTokenSession, operation TKTokenOperation, constraint TKTokenOperationConstraint) (ITKTokenAuthOperation, error)

Tells the delegate that authentication has begun for the specified operation and constraint.

session: The token session.

operation: The kind of operation.

constraint: The constraint to be satisfied.

Return Value

The resulting context of the operation, or `nil` if an error occurred.

Discussion

If you return an instance of a subclass of TKTokenAuthOperation that is provided by the CryptoTokenKit framework, the system will first fill in the context-specific properties, such as the password, before calling the “ method on the context.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:beginAuthFor:constraint:)

func (TKTokenSessionDelegateObject) TokenSessionDecryptDataUsingKeyAlgorithmError

func (o TKTokenSessionDelegateObject) TokenSessionDecryptDataUsingKeyAlgorithmError(session ITKTokenSession, ciphertext foundation.NSData, keyObjectID TKTokenObjectID, algorithm ITKTokenKeyAlgorithm) (foundation.NSData, error)

Tells the delegate to decrypt a data object using the specified key and algorithm.

session: The token session.

ciphertext: The data to decrypt.

keyObjectID: The identifier of the public key object.

algorithm: The algorithm to be used for decryption.

Return Value

The decrypted data, or `nil` if an error occurred.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:decrypt:keyObjectID:algorithm:)

func (TKTokenSessionDelegateObject) TokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError

func (o TKTokenSessionDelegateObject) TokenSessionPerformKeyExchangeWithPublicKeyUsingKeyAlgorithmParametersError(session ITKTokenSession, otherPartyPublicKeyData foundation.NSData, objectID TKTokenObjectID, algorithm ITKTokenKeyAlgorithm, parameters ITKTokenKeyExchangeParameters) (foundation.NSData, error)

Tells the delegate to perform a key exchange using the specified key and algorithm.

session: The token session.

otherPartyPublicKeyData: The public key of the other party.

objectID: The identifier of the private key object.

algorithm: The algorithm to be used for key exchange.

parameters: Additional parameters used by `algorithm` to perform the key exchange.

Return Value

The result of the key exchange, or `nil` if an error occurred.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:performKeyExchange:keyObjectID:algorithm:parameters:)

func (TKTokenSessionDelegateObject) TokenSessionSignDataUsingKeyAlgorithmError

func (o TKTokenSessionDelegateObject) TokenSessionSignDataUsingKeyAlgorithmError(session ITKTokenSession, dataToSign foundation.NSData, keyObjectID TKTokenObjectID, algorithm ITKTokenKeyAlgorithm) (foundation.NSData, error)

Tells the delegate to sign a data object using the specified key and algorithm.

session: The token session.

dataToSign: The data to sign.

keyObjectID: The identifier of the private key object.

algorithm: The algorithm to be used for signing.

Return Value

The signed data, or `nil` if an error occurred.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:sign:keyObjectID:algorithm:)

func (TKTokenSessionDelegateObject) TokenSessionSupportsOperationUsingKeyAlgorithm

func (o TKTokenSessionDelegateObject) TokenSessionSupportsOperationUsingKeyAlgorithm(session ITKTokenSession, operation TKTokenOperation, keyObjectID TKTokenObjectID, algorithm ITKTokenKeyAlgorithm) bool

Asks the delegate whether the token session supports a given operation using the specified key and algorithm.

session: The token session.

operation: The operation to perform. For possible values, see TKTokenOperation.

keyObjectID: The identifier of the private key object.

algorithm: The algorithm to be used by the operation.

Return Value

true if the operation is supported; otherwise, false.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:supports:keyObjectID:algorithm:)

type TKTokenSmartCardPINAuthOperation

type TKTokenSmartCardPINAuthOperation struct {
	TKTokenAuthOperation
}

A Smart Card PIN authentication operation.

Configuring the Operation

Accessing the PIN

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation

func NewTKTokenSmartCardPINAuthOperation

func NewTKTokenSmartCardPINAuthOperation() TKTokenSmartCardPINAuthOperation

NewTKTokenSmartCardPINAuthOperation creates a new TKTokenSmartCardPINAuthOperation instance.

func TKTokenSmartCardPINAuthOperationFromID

func TKTokenSmartCardPINAuthOperationFromID(id objc.ID) TKTokenSmartCardPINAuthOperation

TKTokenSmartCardPINAuthOperationFromID constructs a TKTokenSmartCardPINAuthOperation from an objc.ID.

A Smart Card PIN authentication operation.

func (TKTokenSmartCardPINAuthOperation) APDUTemplate

The template into which the PIN is filled in. `nil` by default.

Discussion

If `nil`, the system will not attempt to authenticate by sending the formatted APDU to the Smart Card. Instead, the token itself is expected to perform the authentication. You are encouraged to provide an APDU template, if possible, as it allows the use of a hardware interface for secure PIN entry, provided one exists.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation/apduTemplate

func (TKTokenSmartCardPINAuthOperation) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenSmartCardPINAuthOperation) Init

Init initializes the instance.

func (TKTokenSmartCardPINAuthOperation) PIN

The PIN value resulting from performing the operation.

Discussion

This property is set to the result of the operation after “ is called.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation/pin

func (TKTokenSmartCardPINAuthOperation) PINByteOffset

func (t TKTokenSmartCardPINAuthOperation) PINByteOffset() int

The offset, in bytes, within the APDU template to mark the location for filling in the PIN.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation/pinByteOffset

func (TKTokenSmartCardPINAuthOperation) PINFormat

The PIN format.

Discussion

By default, this property is set to a TKSmartCardPINFormat object initialized without any further configuration.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation/pinFormat

func (TKTokenSmartCardPINAuthOperation) SetAPDUTemplate

func (t TKTokenSmartCardPINAuthOperation) SetAPDUTemplate(value foundation.NSData)

func (TKTokenSmartCardPINAuthOperation) SetPIN

func (t TKTokenSmartCardPINAuthOperation) SetPIN(value string)

func (TKTokenSmartCardPINAuthOperation) SetPINByteOffset

func (t TKTokenSmartCardPINAuthOperation) SetPINByteOffset(value int)

func (TKTokenSmartCardPINAuthOperation) SetPINFormat

func (TKTokenSmartCardPINAuthOperation) SetSmartCard

func (t TKTokenSmartCardPINAuthOperation) SetSmartCard(value ITKSmartCard)

func (TKTokenSmartCardPINAuthOperation) SmartCard

A Smart Card to which the formatted APDU is sent in order to authenticate.

Discussion

This property is only used if the TKTokenSmartCardPINAuthOperation.APDUTemplate property has a set value.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenSmartCardPINAuthOperation/smartCard

type TKTokenSmartCardPINAuthOperationClass

type TKTokenSmartCardPINAuthOperationClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenSmartCardPINAuthOperationClass

func GetTKTokenSmartCardPINAuthOperationClass() TKTokenSmartCardPINAuthOperationClass

GetTKTokenSmartCardPINAuthOperationClass returns the class object for TKTokenSmartCardPINAuthOperation.

func (TKTokenSmartCardPINAuthOperationClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenSmartCardPINAuthOperationClass) Class

Class returns the underlying Objective-C class pointer.

type TKTokenWatcher

type TKTokenWatcher struct {
	objectivec.Object
}

An object that tracks the tokens available in the system.

Overview

Create a token watcher and register an insertion handler to be notified when tokens are added to the system. You can also add removal handlers for specific tokens to be notified when those tokens are removed from the system.

Accessing Token Identifiers

Configuring Handlers

Instance Methods

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher

func NewTKTokenWatcher

func NewTKTokenWatcher() TKTokenWatcher

NewTKTokenWatcher creates a new TKTokenWatcher instance.

func TKTokenWatcherFromID

func TKTokenWatcherFromID(id objc.ID) TKTokenWatcher

TKTokenWatcherFromID constructs a TKTokenWatcher from an objc.ID.

An object that tracks the tokens available in the system.

func (TKTokenWatcher) AddRemovalHandlerForTokenID

func (t TKTokenWatcher) AddRemovalHandlerForTokenID(removalHandler StringHandler, tokenID string)

Adds a removal handler for the specified token ID.

removalHandler: A block to be called when the specified token is removed. This block takes a single argument:

tokenID: The identifier of the removed token.

tokenID: The identifier of the token to watch for removal.

If TKTokenWatcher.TokenIDs doesn’t contain `tokenID`, `insertionHandler` is executed immediately.

Discussion

You typically call this method in the `insertionHandler` passed to the token watcher initializer.

Adding a removal handler will remove any existing removal handlers for the specified token ID.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher/addRemovalHandler(_:forTokenID:)

func (TKTokenWatcher) Autorelease

func (t TKTokenWatcher) Autorelease() TKTokenWatcher

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenWatcher) Init

func (t TKTokenWatcher) Init() TKTokenWatcher

Init initializes the instance.

func (TKTokenWatcher) SetInsertionHandler

func (t TKTokenWatcher) SetInsertionHandler(insertionHandler StringHandler)

Sets an insertion handler closure to be called when a new token is inserted into the system.

insertionHandler: A closure to be called whenever a token is added to the system. The closure takes a single argument, the tokenID, that identifies the added token.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher/setInsertionHandler(_:)

func (TKTokenWatcher) SetInsertionHandlerSync

func (t TKTokenWatcher) SetInsertionHandlerSync(ctx context.Context) (*string, error)

SetInsertionHandlerSync is a synchronous wrapper around TKTokenWatcher.SetInsertionHandler. It blocks until the completion handler fires or the context is cancelled.

func (TKTokenWatcher) TokenIDs

func (t TKTokenWatcher) TokenIDs() []string

The token IDs currently available in the system.

Discussion

Each string in TKTokenWatcher.TokenIDs corresponds to the name of the token instance.

You can observe this property to be notified of additions and removals to system tokens. See Key-Value Observing Programming Guide for more information.

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher/tokenIDs

type TKTokenWatcherClass

type TKTokenWatcherClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenWatcherClass

func GetTKTokenWatcherClass() TKTokenWatcherClass

GetTKTokenWatcherClass returns the class object for TKTokenWatcher.

func (TKTokenWatcherClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenWatcherClass) Class

func (tc TKTokenWatcherClass) Class() objc.Class

Class returns the underlying Objective-C class pointer.

type TKTokenWatcherTokenInfo

type TKTokenWatcherTokenInfo struct {
	objectivec.Object
}

Instance Properties

See: https://developer.apple.com/documentation/CryptoTokenKit/TKTokenWatcher/TokenInfo

func NewTKTokenWatcherTokenInfo

func NewTKTokenWatcherTokenInfo() TKTokenWatcherTokenInfo

NewTKTokenWatcherTokenInfo creates a new TKTokenWatcherTokenInfo instance.

func TKTokenWatcherTokenInfoFromID

func TKTokenWatcherTokenInfoFromID(id objc.ID) TKTokenWatcherTokenInfo

TKTokenWatcherTokenInfoFromID constructs a TKTokenWatcherTokenInfo from an objc.ID.

func (TKTokenWatcherTokenInfo) Autorelease

Autorelease adds the receiver to the current autorelease pool.

func (TKTokenWatcherTokenInfo) Init

Init initializes the instance.

type TKTokenWatcherTokenInfoClass

type TKTokenWatcherTokenInfoClass struct {
	// contains filtered or unexported fields
}

func GetTKTokenWatcherTokenInfoClass

func GetTKTokenWatcherTokenInfoClass() TKTokenWatcherTokenInfoClass

GetTKTokenWatcherTokenInfoClass returns the class object for TKTokenWatcherTokenInfo.

func (TKTokenWatcherTokenInfoClass) Alloc

Alloc allocates memory for a new instance of the class.

func (TKTokenWatcherTokenInfoClass) Class

Class returns the underlying Objective-C class pointer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL