---
title: TKSmartCard
framework: cryptotokenkit
role: symbol
role_heading: Class
path: cryptotokenkit/tksmartcard
---

# TKSmartCard

A representation of a smart card.

## Declaration

```swift
class TKSmartCard
```

## Overview

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 makeSmartCard() method on the corresponding TKSmartCardSlot object. To start communicating with the smart card, call the beginSession(reply:) method on the TKSmartCard object. Once an exclusive session has been established, you transmit data using the transmit(_:reply:) method. After you’ve finished communicating with a smart card, you call the endSession() method. If the smart card is physically removed from its slot, the session object becomes invalid, and any further calls to transmit(_:reply:) will return an error. You can use Key-Value Observing on the isValid property to be notified when a smart card is invalidated, due to being removed from the slot or another reason.

## Topics

### Configuring the Smart Card

- [slot](cryptotokenkit/tksmartcard/slot.md)
- [isValid](cryptotokenkit/tksmartcard/isvalid.md)
- [isSensitive](cryptotokenkit/tksmartcard/issensitive.md)
- [context](cryptotokenkit/tksmartcard/context.md)

### Setting the Communication Protocol

- [allowedProtocols](cryptotokenkit/tksmartcard/allowedprotocols.md)
- [currentProtocol](cryptotokenkit/tksmartcard/currentprotocol.md)
- [TKSmartCardProtocol](cryptotokenkit/tksmartcardprotocol.md)

### Communicating with the Smart Card

- [beginSession(reply:)](cryptotokenkit/tksmartcard/beginsession(reply:).md)
- [transmit(_:reply:)](cryptotokenkit/tksmartcard/transmit(_:reply:).md)
- [endSession()](cryptotokenkit/tksmartcard/endsession().md)

### Managing User Interaction

- [userInteractionForSecurePINVerification(_:apdu:pinByteOffset:)](cryptotokenkit/tksmartcard/userinteractionforsecurepinverification(_:apdu:pinbyteoffset:).md)
- [userInteractionForSecurePINChange(_:apdu:currentPINByteOffset:newPINByteOffset:)](cryptotokenkit/tksmartcard/userinteractionforsecurepinchange(_:apdu:currentpinbyteoffset:newpinbyteoffset:).md)
- [TKSmartCardPINFormat](cryptotokenkit/tksmartcardpinformat.md)
- [TKSmartCardUserInteraction](cryptotokenkit/tksmartcarduserinteraction.md)
- [TKSmartCardUserInteractionForPINOperation](cryptotokenkit/tksmartcarduserinteractionforpinoperation.md)
- [TKSmartCardUserInteractionForSecurePINChange](cryptotokenkit/tksmartcarduserinteractionforsecurepinchange.md)
- [TKSmartCardUserInteractionForSecurePINVerification](cryptotokenkit/tksmartcarduserinteractionforsecurepinverification.md)

### Configuring APDU Behavior

- [cla](cryptotokenkit/tksmartcard/cla.md)
- [useExtendedLength](cryptotokenkit/tksmartcard/useextendedlength.md)
- [useCommandChaining](cryptotokenkit/tksmartcard/usecommandchaining.md)

### Transmitting Data

- [send(ins:p1:p2:data:le:reply:)](cryptotokenkit/tksmartcard/send(ins:p1:p2:data:le:reply:).md)
- [withSession(_:)](cryptotokenkit/tksmartcard/withsession(_:).md)

### Instance Methods

- [send(ins:p1:p2:data:le:)](cryptotokenkit/tksmartcard/send(ins:p1:p2:data:le:)-1kbga.md)
- [send(ins:p1:p2:data:le:)](cryptotokenkit/tksmartcard/send(ins:p1:p2:data:le:)-6dore.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Smart Cards

- [Using Cryptographic Assets Stored on a Smart Card](cryptotokenkit/using-cryptographic-assets-stored-on-a-smart-card.md)
- [TKSmartCardSlotManager](cryptotokenkit/tksmartcardslotmanager.md)
- [TKSmartCardSlot](cryptotokenkit/tksmartcardslot.md)
