---
product: Chilkat
product_version: 11.7.0
language: tcl
language_label: Tcl
class: ScMinidriver
license: bundle
platforms: windows
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/tclScMinidriverRef.html
---
# Chilkat ScMinidriver — Tcl — v11.7.0

> Chilkat 11.7.0 · language=tcl · class=ScMinidriver · platforms=windows
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/ScMinidriver.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/guide.md`.

## Purpose

**Available only on: windows.** Do not use this class on other platforms.

**Access smart-card certificates, key containers, PINs, files, and on-card signing.**

`Chilkat.ScMinidriver` is a smart-card integration class for applications that need card minidriver access to certificates, key containers, PIN authentication, card files, and on-card signing. It can retrieve and link smart-card certificates for use in other Chilkat signing classes, generate or import RSA and ECC keys, sign data directly, inspect card and container state, and manage selected card files and certificates.

**Connect through minidriver**

Use the Windows smart-card minidriver layer to access card capabilities without working directly at the APDU level.

**Certificates and containers**

Enumerate and inspect smart-card certificates, key containers, container indexes, key types, and related card state.

**PIN authentication**

Authenticate to the card with the required PIN before accessing protected private-key operations or card objects.

**On-card signing**

Sign data using private keys that remain on the smart card, including workflows where the private key is non-exportable.

**Key generation and import**

Generate or import RSA and ECC keys into supported card containers when the card policy allows it.

**Use with Chilkat signing**

Link a smart-card certificate to other Chilkat classes so PDF, XML, CMS/PKCS7, S/MIME, or other signing operations can use the card-backed private key.

**Common pattern:** Connect to the smart card, verify the card and container state, authenticate with the PIN, locate the certificate and private-key container, then either sign directly or link the certificate for use by another Chilkat signing class. Use `ScMinidriver` for Windows card-minidriver certificate and key-container operations; use `Chilkat.SCard` for direct PC/SC APDU-level work, and `Chilkat.Pkcs11` for PKCS#11 token or HSM sessions.

For an extended overview, see [ScMinidriver Class Overview](https://www.chilkatsoft.com/scminidriver_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```tcl
# 'this' is not a keyword in Tcl. It can freely be used as a variable name.
set this [new CkScMinidriver]
```

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Tcl.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `string # ckStr is a CkString CkScMinidriver_get_DebugLogFilePath $this $ckStr set strVal [CkScMinidriver_get_debugLogFilePath $this] CkScMinidriver_put_DebugLogFilePath $this $strVal` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `string # ckStr is a CkString CkScMinidriver_get_LastErrorHtml $this $ckStr set strVal [CkScMinidriver_get_lastErrorHtml $this]` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `string # ckStr is a CkString CkScMinidriver_get_LastErrorText $this $ckStr set strVal [CkScMinidriver_get_lastErrorText $this]` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `string # ckStr is a CkString CkScMinidriver_get_LastErrorXml $this $ckStr set strVal [CkScMinidriver_get_lastErrorXml $this]` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `boolean 1/0 set boolVal [CkScMinidriver_get_LastMethodSuccess $this] CkScMinidriver_put_LastMethodSuccess $this $boolVal` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `Utf8` | `boolean 1/0 set boolVal [CkScMinidriver_get_Utf8 $this] CkScMinidriver_put_Utf8 $this $boolVal` | read/write | When set to `1`, all `string` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `boolean 1/0 set boolVal [CkScMinidriver_get_VerboseLogging $this] CkScMinidriver_put_VerboseLogging $this $boolVal` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `string # ckStr is a CkString CkScMinidriver_get_Version $this $ckStr set strVal [CkScMinidriver_get_version $this]` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `Atr` | property, read-only | `string # ckStr is a CkString CkScMinidriver_get_Atr $this $ckStr set strVal [CkScMinidriver_get_atr $this]` |
| `CardName` | property, read-only | `string # ckStr is a CkString CkScMinidriver_get_CardName $this $ckStr set strVal [CkScMinidriver_get_cardName $this]` |
| `MaxContainers` | property, read-only | `integer set intVal [CkScMinidriver_get_MaxContainers $this]` |
| `RsaPaddingHash` | property, read/write | `string # ckStr is a CkString CkScMinidriver_get_RsaPaddingHash $this $ckStr set strVal [CkScMinidriver_get_rsaPaddingHash $this] CkScMinidriver_put_RsaPaddingHash $this $strVal` |
| `RsaPaddingScheme` | property, read/write | `string # ckStr is a CkString CkScMinidriver_get_RsaPaddingScheme $this $ckStr set strVal [CkScMinidriver_get_rsaPaddingScheme $this] CkScMinidriver_put_RsaPaddingScheme $this $strVal` |
| `UncommonOptions` | property, read/write | `string # ckStr is a CkString CkScMinidriver_get_UncommonOptions $this $ckStr set strVal [CkScMinidriver_get_uncommonOptions $this] CkScMinidriver_put_UncommonOptions $this $strVal` |
| `AcquireContext` | method | `# readerName is a string set status [CkScMinidriver_AcquireContext $this $readerName]` |
| `CardDeleteFile` | method | `# dirName is a string # fileName is a string set status [CkScMinidriver_CardDeleteFile $this $dirName $fileName]` |
| `DeleteCert` | method | `# cert is a CkCert # delPrivKey is a boolean set status [CkScMinidriver_DeleteCert $this $cert $delPrivKey]` |
| `DeleteContext` | method | `set status [CkScMinidriver_DeleteContext $this]` |
| `DeleteKeyContainer` | method | `# containerIndex is an integer set status [CkScMinidriver_DeleteKeyContainer $this $containerIndex]` |
| `EnumFiles` | method | `# dirName is a string # st is a CkStringTable set status [CkScMinidriver_EnumFiles $this $dirName $st]` |
| `FindCert` | method | `# certPart is a string # partValue is a string # cert is a CkCert set status [CkScMinidriver_FindCert $this $certPart $partValue $cert]` |
| `GenerateKey` | method | `# containerIndex is an integer # keySpec is a string # keyType is a string # keySize is an integer # pinId is a string set status [CkScMinidriver_GenerateKey $this $containerIndex $keySpec $keyType $keySize $pinId]` |
| `GetCardProperties` | method | `# json is a CkJsonObject set status [CkScMinidriver_GetCardProperties $this $json]` |
| `GetCert` | method | `# containerIndex is an integer # keySpec is a string # cert is a CkCert set status [CkScMinidriver_GetCert $this $containerIndex $keySpec $cert]` |
| `GetContainerKeys` | method | `# containerIndex is an integer # sigKey is a CkPublicKey # kexKey is a CkPublicKey set status [CkScMinidriver_GetContainerKeys $this $containerIndex $sigKey $kexKey]` |
| `GetCspContainerMap` | method | `# json is a CkJsonObject set status [CkScMinidriver_GetCspContainerMap $this $json]` |
| `ImportCert` | method | `# cert is a CkCert # containerIndex is an integer # keySpec is a string # pinId is a string set status [CkScMinidriver_ImportCert $this $cert $containerIndex $keySpec $pinId]` |
| `ImportKey` | method | `# containerIndex is an integer # keySpec is a string # privKey is a CkPrivateKey # pinId is a string set status [CkScMinidriver_ImportKey $this $containerIndex $keySpec $privKey $pinId]` |
| `ListCerts` | method | `# certPart is a string # st is a CkStringTable set status [CkScMinidriver_ListCerts $this $certPart $st]` |
| `PinAuthenticate` | method | `# pinId is a string # pin is a string set retInt [CkScMinidriver_PinAuthenticate $this $pinId $pin]` |
| `PinAuthenticateHex` | method | `# pinId is a string # pin is a string set retInt [CkScMinidriver_PinAuthenticateHex $this $pinId $pin]` |
| `PinChange` | method | `# pinId is a string # currentPin is a string # newPin is a string set retInt [CkScMinidriver_PinChange $this $pinId $currentPin $newPin]` |
| `PinDeauthenticate` | method | `# pinId is a string set status [CkScMinidriver_PinDeauthenticate $this $pinId]` |
| `ReadFile` | method | `# dirName is a string # fileName is a string # bd is a CkBinData set status [CkScMinidriver_ReadFile $this $dirName $fileName $bd]` |
| `SignData` | method | `# containerIndex is an integer # keySpec is a string # hashDataAlg is a string # bdData is a CkBinData # bdSignedData is a CkBinData set status [CkScMinidriver_SignData $this $containerIndex $keySpec $hashDataAlg $bdData $bdSignedData]` |
| `WriteFile` | method | `# dirName is a string # fileName is a string # bd is a CkBinData set status [CkScMinidriver_WriteFile $this $dirName $fileName $bd]` |

## Properties

### ScMinidriver.Atr

`Chilkat 11.7.0 · tcl · ScMinidriver · Atr · property · read-only · since 9.5.0.87`

```tcl
string
# ckStr is a CkString

CkScMinidriver_get_Atr $this $ckStr

set strVal [CkScMinidriver_get_atr $this]
```

The ATR of the card in the reader. This property is set by the AquireContext method.

### ScMinidriver.CardName

`Chilkat 11.7.0 · tcl · ScMinidriver · CardName · property · read-only · since 9.5.0.87`

```tcl
string
# ckStr is a CkString

CkScMinidriver_get_CardName $this $ckStr

set strVal [CkScMinidriver_get_cardName $this]
```

The name of the card in the reader. This property is set by the AquireContext method.

### ScMinidriver.MaxContainers

`Chilkat 11.7.0 · tcl · ScMinidriver · MaxContainers · property · read-only · since 9.5.0.87`

```tcl
integer
set intVal [CkScMinidriver_get_MaxContainers $this]
```

The maximum number of key containers available. The 1st key container is at index 0. Each key container can potentially contain one signature key, and one key exchange key.

### ScMinidriver.RsaPaddingHash

`Chilkat 11.7.0 · tcl · ScMinidriver · RsaPaddingHash · property · read/write · since 9.5.0.87`

```tcl
string
# ckStr is a CkString

CkScMinidriver_get_RsaPaddingHash $this $ckStr

set strVal [CkScMinidriver_get_rsaPaddingHash $this]

CkScMinidriver_put_RsaPaddingHash $this $strVal
```

If an RSA key is used for signing, this is the hash algorithm to used in conjunction with the padding scheme. It can be `SHA1`, `SHA256`, `SHA384`, or `SHA512`. The default is `SHA256`.

### ScMinidriver.RsaPaddingScheme

`Chilkat 11.7.0 · tcl · ScMinidriver · RsaPaddingScheme · property · read/write · since 9.5.0.87`

```tcl
string
# ckStr is a CkString

CkScMinidriver_get_RsaPaddingScheme $this $ckStr

set strVal [CkScMinidriver_get_rsaPaddingScheme $this]

CkScMinidriver_put_RsaPaddingScheme $this $strVal
```

If an RSA key is used for signing, this is the padding scheme to use. It can be `PKCS` or `PSS`. The default is `PSS`.

### ScMinidriver.UncommonOptions

`Chilkat 11.7.0 · tcl · ScMinidriver · UncommonOptions · property · read/write · since 9.5.0.87`

```tcl
string
# ckStr is a CkString

CkScMinidriver_get_UncommonOptions $this $ckStr

set strVal [CkScMinidriver_get_uncommonOptions $this]

CkScMinidriver_put_UncommonOptions $this $strVal
```

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string and should typically remain empty.

## Methods

### ScMinidriver.AcquireContext

`Chilkat 11.7.0 · tcl · ScMinidriver · AcquireContext · method · since 9.5.0.87`

```tcl
# readerName is a string

set status [CkScMinidriver_AcquireContext $this $readerName]
```

Initializes communication with the card inserted in the given reader. Reader names can be discovered via the SCard.ListReaders or SCard.FindSmartcards methods. If successful, the Atr and CardName properties will be set.

Returns 1 for success, 0 for failure.

### ScMinidriver.CardDeleteFile

`Chilkat 11.7.0 · tcl · ScMinidriver · CardDeleteFile · method · since 9.5.0.88`

```tcl
# dirName is a string

# fileName is a string

set status [CkScMinidriver_CardDeleteFile $this $dirName  $fileName]
```

Deletes the file specified by `dirName` and `fileName`. `dirName` is the name of the directory that contains the file, or the empty string for root.

Returns 1 for success, 0 for failure.

### ScMinidriver.DeleteCert

`Chilkat 11.7.0 · tcl · ScMinidriver · DeleteCert · method · since 9.5.0.88`

```tcl
# cert is a CkCert

# delPrivKey is a boolean

set status [CkScMinidriver_DeleteCert $this $cert  $delPrivKey]
```

Deletes a certificate and optionally its associated private key from the smart card. If `delPrivKey` is `1`, then the associated private key, if it exists, is also deleted.

Returns 1 for success, 0 for failure.

### ScMinidriver.DeleteContext

`Chilkat 11.7.0 · tcl · ScMinidriver · DeleteContext · method · since 9.5.0.87`

```tcl
set status [CkScMinidriver_DeleteContext $this]
```

This function reverses the effect of AcquireContext and severs the communication between the Base CSP/KSP and the card minidriver. The Atr and CardName properties are cleared.

Returns 1 for success, 0 for failure.

### ScMinidriver.DeleteKeyContainer

`Chilkat 11.7.0 · tcl · ScMinidriver · DeleteKeyContainer · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

set status [CkScMinidriver_DeleteKeyContainer $this $containerIndex]
```

Deletes the key container at the given `containerIndex`. This deletes both the `signature` and `key exchange` keys that may be contained in the specified key container.

Returns 1 for success, 0 for failure.

### ScMinidriver.EnumFiles

`Chilkat 11.7.0 · tcl · ScMinidriver · EnumFiles · method · since 9.5.0.87`

```tcl
# dirName is a string

# st is a CkStringTable

set status [CkScMinidriver_EnumFiles $this $dirName  $st]
```

Get the list of files in the directory specified by `dirName`. Pass the empty string for the root directory. The filenames are returned in `st`.

Returns 1 for success, 0 for failure.

### ScMinidriver.FindCert

`Chilkat 11.7.0 · tcl · ScMinidriver · FindCert · method · since 9.5.0.87`

```tcl
# certPart is a string

# partValue is a string

# cert is a CkCert

set status [CkScMinidriver_FindCert $this $certPart  $partValue  $cert]
```

Finds the certificate where the given `certPart` equals the `partValue`. Possible values for `certPart` are: `subjectDN`, `subjectDN_withTags`, `subjectCN`, `serial`, or `serial:issuerCN`.

The `cert` is loaded with the certificate if successful.

Note: If successful, the `cert` will be linked internally with this ScMinidriver session such that certificate can be used for signing on the smart card when used in other Chilkat classes such as XmlDSigGen, Pdf, Crypt2, Mime, MailMan, etc.

Returns 1 for success, 0 for failure.

### ScMinidriver.GenerateKey

`Chilkat 11.7.0 · tcl · ScMinidriver · GenerateKey · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

# keySpec is a string

# keyType is a string

# keySize is an integer

# pinId is a string

set status [CkScMinidriver_GenerateKey $this $containerIndex  $keySpec  $keyType  $keySize  $pinId]
```

Generates a key to be stored in either the `signature` or `key exchange` location within a key container. Creates the key container if it does not already exist. Otherwise replaces the key in the key container.

The `keySpec` can be `sig` or `kex` to specify either the `signature` or `key exchange` location.

The `keyType` can be `ecc` or `rsa`.

For RSA keys, the `keySize` is the size of the key in bits, such as 1024, 2048, 4096, etc. (2048 is a typical value.) For ECC keys, the size can be 256, 384, or 521.

The `pinId` can be `user`, or `3` through `7`. (It is typically `user`.)

Returns 1 for success, 0 for failure.

### ScMinidriver.GetCardProperties

`Chilkat 11.7.0 · tcl · ScMinidriver · GetCardProperties · method · since 9.5.0.87`

```tcl
# json is a CkJsonObject

set status [CkScMinidriver_GetCardProperties $this $json]
```

Gets all card properties and returns them in `json`. See the example below.

Returns 1 for success, 0 for failure.

### ScMinidriver.GetCert

`Chilkat 11.7.0 · tcl · ScMinidriver · GetCert · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

# keySpec is a string

# cert is a CkCert

set status [CkScMinidriver_GetCert $this $containerIndex  $keySpec  $cert]
```

Get the certificate at the specified `containerIndex` and `keySpec`. The `keySpec` can be `sig` or `kex` to specify either the `signature` or `key exchange` location within the container. The `containerIndex` can be -1 to choose the first key container with a certificate. The `keySpec` can also be `any` to choose either `sig` or `kex` based on which is present, with preference given to `sig` if both are present.

The `cert` is loaded with the certificate if successful.

Note: If successful, the `cert` will be linked internally with this ScMinidriver session such that certificate can be used for signing on the smart card when used in other Chilkat classes such as XmlDSigGen, Pdf, Crypt2, Mime, MailMan, etc.

Returns 1 for success, 0 for failure.

### ScMinidriver.GetContainerKeys

`Chilkat 11.7.0 · tcl · ScMinidriver · GetContainerKeys · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

# sigKey is a CkPublicKey

# kexKey is a CkPublicKey

set status [CkScMinidriver_GetContainerKeys $this $containerIndex  $sigKey  $kexKey]
```

Queries a key container to get the keys that are present. If the signature public key is present, it is returned in `sigKey`. If the key exchange key is present, it is returned in `kexKey`.

Returns 1 for success, 0 for failure.

### ScMinidriver.GetCspContainerMap

`Chilkat 11.7.0 · tcl · ScMinidriver · GetCspContainerMap · method · since 9.5.0.87`

```tcl
# json is a CkJsonObject

set status [CkScMinidriver_GetCspContainerMap $this $json]
```

Returns the contents of the CSP container map file (cmapfile). The information is returned in the `json`. This gives an overview of what key containers and certificates exist in the smart card from a CSP's point of view. See the example linked below.

Returns 1 for success, 0 for failure.

### ScMinidriver.ImportCert

`Chilkat 11.7.0 · tcl · ScMinidriver · ImportCert · method · since 9.5.0.87`

```tcl
# cert is a CkCert

# containerIndex is an integer

# keySpec is a string

# pinId is a string

set status [CkScMinidriver_ImportCert $this $cert  $containerIndex  $keySpec  $pinId]
```

Imports a certificate with its private key onto the smart card. The `cert` must have an accessible private key, such as will be the case if the `cert` was loaded from a .pfx/.p12, or if the `cert` was loaded from a Windows certificate store where the private key exists (and can be exported from the Windows certificate store).

The `containerIndex` is the container index. It can range from 0 to the MaxContainers-1.

The `keySpec` can be `sig` or `kex` to specify either the `signature` or `key exchange` location within the container.

The `pinId` can be `user`, or `3` through `7`. (It is typically `user`.)

Returns 1 for success, 0 for failure.

### ScMinidriver.ImportKey

`Chilkat 11.7.0 · tcl · ScMinidriver · ImportKey · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

# keySpec is a string

# privKey is a CkPrivateKey

# pinId is a string

set status [CkScMinidriver_ImportKey $this $containerIndex  $keySpec  $privKey  $pinId]
```

Imports a key to be stored in either the `signature` or `key exchange` location within a key container. Creates the key container if it does not already exist. Otherwise replaces the specified key in the key container.

The `keySpec` can be `sig` or `kex` to specify either the `signature` or `key exchange` location.

The `privKey` is the private key to import.

The ARG5 can be `user`, or `3` through `7`. (It is typically `user`.)

Returns 1 for success, 0 for failure.

### ScMinidriver.ListCerts

`Chilkat 11.7.0 · tcl · ScMinidriver · ListCerts · method · since 9.5.0.87`

```tcl
# certPart is a string

# st is a CkStringTable

set status [CkScMinidriver_ListCerts $this $certPart  $st]
```

Lists the certs found on the smart card. The `certPart` indicates the information to be returned from each certificate. Possible values are: `subjectDN`, `subjectDN_withTags`, `subjectCN`, `serial`, or `serial:issuerCN`. The information is returned in `st`.

Returns 1 for success, 0 for failure.

### ScMinidriver.PinAuthenticate

`Chilkat 11.7.0 · tcl · ScMinidriver · PinAuthenticate · method · since 9.5.0.87`

```tcl
# pinId is a string

# pin is a string

set retInt [CkScMinidriver_PinAuthenticate $this $pinId  $pin]
```

Performs regular PIN authentication. The `pinId` can be `user`, `admin`, or `3` through `7`. (It is typically `user`.) The `pin` is the alphanumeric PIN.

Returns 0 for success. If not successful, the return value indicates the number of attempts remaining before the PIN is locked. (The number of times an incorrect PIN may be presented to the card before the PIN is blocked, and requires the admin to unblock it.) If the PIN is already blocked, the return value is -1. If the method fails for some other reason, such as if a context has not yet been acquired, the return value is -2.

### ScMinidriver.PinAuthenticateHex

`Chilkat 11.7.0 · tcl · ScMinidriver · PinAuthenticateHex · method · since 9.5.0.87`

```tcl
# pinId is a string

# pin is a string

set retInt [CkScMinidriver_PinAuthenticateHex $this $pinId  $pin]
```

The same as PinAutheneticate, but the PIN is passed as a hex string. For example, to pass a PIN of 0x01, 0x02, 0x03, 0x04, pass `01020304`.

### ScMinidriver.PinChange

`Chilkat 11.7.0 · tcl · ScMinidriver · PinChange · method · since 9.5.0.87`

```tcl
# pinId is a string

# currentPin is a string

# newPin is a string

set retInt [CkScMinidriver_PinChange $this $pinId  $currentPin  $newPin]
```

Changes a PIN. The `pinId` can be `user`, `admin`, or `3` through `7`. (It is typically `user`.) The `currentPin` is the current alphanumeric PIN. The `newPin` is the new PIN.

Returns 0 for success. If not successful, the return value indicates the number of attempts remaining before the PIN is locked. (The number of times an incorrect PIN may be presented to the card before the PIN is blocked, and requires the admin to unblock it.) If the PIN is already blocked, the return value is -1. If the method fails for some other reason, such as if a context has not yet been acquired, the return value is -2.

### ScMinidriver.PinDeauthenticate

`Chilkat 11.7.0 · tcl · ScMinidriver · PinDeauthenticate · method · since 9.5.0.87`

```tcl
# pinId is a string

set status [CkScMinidriver_PinDeauthenticate $this $pinId]
```

Reverses a previous PIN authentication without resetting the card. The `pinId` can be `user`, `admin`, or `3` through `7`. (It is typically `user`.)

Returns 1 for success, 0 for failure.

### ScMinidriver.ReadFile

`Chilkat 11.7.0 · tcl · ScMinidriver · ReadFile · method · since 9.5.0.87`

```tcl
# dirName is a string

# fileName is a string

# bd is a CkBinData

set status [CkScMinidriver_ReadFile $this $dirName  $fileName  $bd]
```

Reads the entire file specified by `dirName` and `fileName` into `bd`. `dirName` is the name of the directory that contains the file, or the empty string for root.

Returns 1 for success, 0 for failure.

### ScMinidriver.SignData

`Chilkat 11.7.0 · tcl · ScMinidriver · SignData · method · since 9.5.0.87`

```tcl
# containerIndex is an integer

# keySpec is a string

# hashDataAlg is a string

# bdData is a CkBinData

# bdSignedData is a CkBinData

set status [CkScMinidriver_SignData $this $containerIndex  $keySpec  $hashDataAlg  $bdData  $bdSignedData]
```

Signs the data passed in `bdData`. The `hashDataAlg` can be `sha1`, `sha256`, `sha384`, `sha512`, or `none`. If not equal to `none`, then the hash of the data passed in `bdData` is signed.

The `containerIndex` specifies the key container. By specifying the key container, you are almost specifying the key. A key container can contain two keys: A signature key, and a key-exchange key. The `keySpec` indicates which of these two keys to use. `keySpec` should be set to `sig` or `kex`.

Note: The type of signature created, such as RSA or ECC, is determined by the type of key that exists in the key container (specified by `containerIndex` and `keySpec`). If it is an RSA key, additional options can be specified via the RsaPaddingScheme and RsaPaddingHash properties.

If successful, the signature is written to `bdSignedData`.

Returns 1 for success, 0 for failure.

### ScMinidriver.WriteFile

`Chilkat 11.7.0 · tcl · ScMinidriver · WriteFile · method · since 9.5.0.87`

```tcl
# dirName is a string

# fileName is a string

# bd is a CkBinData

set status [CkScMinidriver_WriteFile $this $dirName  $fileName  $bd]
```

Writes the entire file specified by `dirName` and `fileName`. `dirName` is the name of the directory that contains the file, or the empty string for root. The entire contents of `bd` are written to the file on the smart card.

Returns 1 for success, 0 for failure.

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/BinData.md), [`Cert`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/Cert.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/JsonObject.md), [`PrivateKey`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/PrivateKey.md), [`PublicKey`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/PublicKey.md), [`StringTable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/tcl/classes/StringTable.md)

