---
product: Chilkat
product_version: 11.7.0
language: foxpro
language_label: FoxPro
class: Secrets
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/foxpro_SecretsRef.html
---
# Chilkat Secrets — FoxPro — v11.7.0

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

## Purpose

**Manage application secrets through one consistent API.**

`Chilkat.Secrets` provides a unified interface for storing, retrieving, listing, and deleting secrets across local, cloud-based, and in-memory secret stores. It supports string, binary, and JSON secrets, making it useful for passwords, API keys, OAuth credentials, tokens, unlock codes, certificates, and private configuration data.

**Local secure storage**

- Windows Credential Manager
- Apple Keychain

**Cloud secret managers**

- AWS Secrets Manager
- Azure Key Vault
- IBM Cloud Secrets Manager
- Oracle Cloud Secrets
- Doppler Secrets

**Temporary secrets**

Use in-memory secrets when values should exist only for the lifetime of the running process.

**Flexible content types**

Store and retrieve secrets as strings, binary data, or structured JSON.

**Note:** Cloud-based secret managers often require local bootstrap credentials. These can be stored securely in the Windows Credential Manager or Apple Keychain and then used to authenticate to the cloud secret manager.

Start with the [Conceptual Overview](https://www.chilkatsoft.com/chilkat_secrets_api.asp) and [Components of a Secret Name](https://www.chilkatsoft.com/components_of_a_secret_name.asp). For an extended overview, see the [Secrets Class Overview](https://www.chilkatsoft.com/secrets_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```foxpro
loSecrets = CreateObject('Chilkat.Secrets')
```

Visual FoxPro is a 32-bit application and therefore uses the 32-bit Chilkat ActiveX. To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `CreateObject('Chilkat.Secrets.11')` for Chilkat v11.\*.\*.

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 FoxPro.

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` | `DebugLogFilePath As String` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastBinaryResult` | `LastBinaryResult As Variant (read-only)` | read-only | This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. |
| `LastErrorHtml` | `LastErrorHtml As String (read-only)` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `LastErrorText As String (read-only)` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `LastErrorXml As String (read-only)` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `LastMethodSuccess As Number` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `LastStringResult` | `LastStringResult As String (read-only)` | read-only | In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. |
| `LastStringResultLen` | `LastStringResultLen As Number (read-only)` | read-only | The length, in characters, of the string contained in the LastStringResult property. |
| `VerboseLogging` | `VerboseLogging As Number` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `Version As String (read-only)` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AutoSplit` | property, read/write | `AutoSplit As Number` |
| `Compression` | property, read/write | `Compression As Number` |
| `Location` | property, read/write | `Location As String` |
| `UncommonOptions` | property, read/write | `UncommonOptions As String` |
| `DeleteSecret` | method | `DeleteSecret(jsonId As ChilkatJsonObject) As Number` |
| `GetSecretBd` | method | `GetSecretBd(jsonId As ChilkatJsonObject, bd As ChilkatBinData) As Number` |
| `GetSecretJson` | method | `GetSecretJson(jsonId As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As Number` |
| `GetSecretSb` | method | `GetSecretSb(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As Number` |
| `GetSecretStr` | method | `GetSecretStr(jsonId As ChilkatJsonObject) As String` |
| `ListSecrets` | method | `ListSecrets(json As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As Number` |
| `SecretSpecToJson` | method | `SecretSpecToJson(secretSpec As String, json As ChilkatJsonObject) As Number` |
| `SetBootstrapSecret` | method | `SetBootstrapSecret(jsonId As ChilkatJsonObject, secretContent As ChilkatSecrets) As Number` |
| `UpdateSecretBd` | method | `UpdateSecretBd(jsonId As ChilkatJsonObject, secret As ChilkatBinData) As Number` |
| `UpdateSecretJson` | method | `UpdateSecretJson(jsonId As ChilkatJsonObject, secret As ChilkatJsonObject) As Number` |
| `UpdateSecretSb` | method | `UpdateSecretSb(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As Number` |
| `UpdateSecretStr` | method | `UpdateSecretStr(jsonId As ChilkatJsonObject, secret As String) As Number` |

## Properties

### Secrets.AutoSplit

`Chilkat 11.7.0 · foxpro · Secrets · AutoSplit · property · read/write · since 10.1.0`

```foxpro
AutoSplit As Number
```

The AutoSplit property is specific to `local_manager` secrets on Windows. The Windows Credentials Manager supports a maximum of 2560 bytes per secret. If a secret exceeds this size, it will be automatically compressed and split when created or updated, and automatically recomposed when retrieved.

A secret can be split into a maximum of 10 parts.

The default value is `1`.

### Secrets.Compression

`Chilkat 11.7.0 · foxpro · Secrets · Compression · property · read/write · since 10.1.0`

```foxpro
Compression As Number
```

If set to `1`, then the contents of the secret will be stored compressed. The default value of this property is `0`.

### Secrets.Location

`Chilkat 11.7.0 · foxpro · Secrets · Location · property · read/write · since 10.1.0`

```foxpro
Location As String
```

The location of the secrets. Possible values are:

- `local_manager` - On Windows this is the Credentials Manager. On MacOS and iOS it is the Keychain. This is not yet an option on Linux or Android.
- `aws_secrets_manager` - AWS Secrets Manager
- `azure_key_vault` - Azure Key Vault
- `ibm_cloud` - IBM Cloud Secrets Manager
- `oracle_cloud` - Oracle Cloud Secrets
- `doppler` - Doppler Secrets
- `memory` - In-Memory Secrets

The default location is the `local_manager`. On Linux and Android, `local_manager` will behave the same as `memory`.

### Secrets.UncommonOptions

`Chilkat 11.7.0 · foxpro · Secrets · UncommonOptions · property · read/write · since 10.1.0`

```foxpro
UncommonOptions As String
```

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

### Secrets.DeleteSecret

`Chilkat 11.7.0 · foxpro · Secrets · DeleteSecret · method · since 10.1.0`

```foxpro
DeleteSecret(jsonId As ChilkatJsonObject) As Number
```

Deletes a secret. Cloud secrets managers will typically disable the secret and schedule the secret for deletion after some number of days.

Returns 1 for success, 0 for failure.

Async variant: `DeleteSecretAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.GetSecretBd

`Chilkat 11.7.0 · foxpro · Secrets · GetSecretBd · method · since 10.1.0`

```foxpro
GetSecretBd(jsonId As ChilkatJsonObject, bd As ChilkatBinData) As Number
```

Fetches a binary secret and returns the content in `bd`.

Returns 1 for success, 0 for failure.

Async variant: `GetSecretBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.GetSecretJson

`Chilkat 11.7.0 · foxpro · Secrets · GetSecretJson · method · since 10.1.0`

```foxpro
GetSecretJson(jsonId As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As Number
```

Fetches a JSON secret and returns the content in `jsonOut`.

Returns 1 for success, 0 for failure.

Async variant: `GetSecretJsonAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.GetSecretSb

`Chilkat 11.7.0 · foxpro · Secrets · GetSecretSb · method · since 10.1.0`

```foxpro
GetSecretSb(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As Number
```

Fetches a string secret and returns the content in `sb`.

Returns 1 for success, 0 for failure.

Async variant: `GetSecretSbAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.GetSecretStr

`Chilkat 11.7.0 · foxpro · Secrets · GetSecretStr · method · since 10.1.0`

```foxpro
GetSecretStr(jsonId As ChilkatJsonObject) As String
```

Fetches a string secret and returns the content of the secret.

Returns `.NULL.` on failure

Async variant: `GetSecretStrAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.ListSecrets

`Chilkat 11.7.0 · foxpro · Secrets · ListSecrets · method · since 10.1.0`

```foxpro
ListSecrets(json As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As Number
```

Lists secrets matching the wildcarded or exact values passed in `json`. The results of the query are returned in `jsonOut`.

Returns 1 for success, 0 for failure.

Async variant: `ListSecretsAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.SecretSpecToJson

`Chilkat 11.7.0 · foxpro · Secrets · SecretSpecToJson · method · since 11.5.0`

```foxpro
SecretSpecToJson(secretSpec As String, json As ChilkatJsonObject) As Number
```

Converts a secret specification string (`secretSpec`) to JSON. A secret specification string is formatted as "!!part1\|part2\|part3\|part4" where parts 3 and 4 are optional. `json` is the output argument.

Returns 1 for success, 0 for failure.

### Secrets.SetBootstrapSecret

`Chilkat 11.7.0 · foxpro · Secrets · SetBootstrapSecret · method · since 10.1.0`

```foxpro
SetBootstrapSecret(jsonId As ChilkatJsonObject, secretContent As ChilkatSecrets) As Number
```

Accessing a cloud-based secrets manager requires authentication credentials, which cannot be stored in the manager itself. Instead, they must be securely stored locally.

One solution is to store the authentication credentials as a secret in the Windows Credentials Manager or Apple Keychain. These credentials serve as the `bootstrap secret` for authenticating with the cloud-based secrets manager.

`jsonId` contains the name of the bootstrap secret. `secretContent` contains the bootstrap's secret content.

Returns 1 for success, 0 for failure.

### Secrets.UpdateSecretBd

`Chilkat 11.7.0 · foxpro · Secrets · UpdateSecretBd · method · since 10.1.0`

```foxpro
UpdateSecretBd(jsonId As ChilkatJsonObject, secret As ChilkatBinData) As Number
```

Creates a binary secret if it does not yet exist, or updates an existing secret. The name of the secret is specified in `jsonId`, and the binary content of the secret in `secret`.

Returns 1 for success, 0 for failure.

Async variant: `UpdateSecretBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.UpdateSecretJson

`Chilkat 11.7.0 · foxpro · Secrets · UpdateSecretJson · method · since 10.1.0`

```foxpro
UpdateSecretJson(jsonId As ChilkatJsonObject, secret As ChilkatJsonObject) As Number
```

Creates a JSON secret if it does not yet exist, or updates an existing secret. The name of the secret is specified in `jsonId`, and the JSON content of the secret in `secret`.

Returns 1 for success, 0 for failure.

Async variant: `UpdateSecretJsonAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.UpdateSecretSb

`Chilkat 11.7.0 · foxpro · Secrets · UpdateSecretSb · method · since 10.1.0`

```foxpro
UpdateSecretSb(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As Number
```

Creates a string secret if it does not yet exist, or updates an existing secret. The name of the secret is specified in `jsonId`, and the string content of the secret in `sb`.

Returns 1 for success, 0 for failure.

Async variant: `UpdateSecretSbAsync` — same arguments, returns a `Task` (see Async variants below).

### Secrets.UpdateSecretStr

`Chilkat 11.7.0 · foxpro · Secrets · UpdateSecretStr · method · since 10.1.0`

```foxpro
UpdateSecretStr(jsonId As ChilkatJsonObject, secret As String) As Number
```

Creates a string secret if it does not yet exist, or updates an existing secret. The name of the secret is specified in `jsonId`, and the string content of the secret in `secret`.

Note: Starting in Chilkat **v11.3.0**, if the `service` = `"Chilkat"` and the `username` = `"unlock_code"`, then the secret (which is the Chilkat unlock code) can be stored and retrieved without Chilkat being unlocked. This allows for the Chilkat unlock code itself to be persisted to a secrets manager.

Returns 1 for success, 0 for failure.

Async variant: `UpdateSecretStrAsync` — same arguments, returns a `Task` (see Async variants below).

## Events and callbacks

A Visual FoxPro application receives Chilkat ActiveX events by defining a class that `IMPLEMENTS` the `_IChilkatEvents` interface, creating an instance of it, and binding that instance to the Chilkat object with `EVENTHANDLER()`. Visual FoxPro requires the class to implement every method of the interface, so the class below includes a `PROCEDURE` for each event; leave the ones you do not need empty. The `TextData` and `BinaryData` events are defunct: they are deprecated and are never called, but their procedures must still exist because the interface declares them.

**Important:** Event callbacks from ***asynchronous method calls*** are generally not possible from the ActiveX. Events fire during synchronous method calls.

```foxpro
secretsEventHandler = CREATEOBJECT("MySecretsEvents")
loSecrets = CreateObject('Chilkat.Secrets')
EVENTHANDLER(loSecrets, secretsEventHandler)

DEFINE CLASS MySecretsEvents AS SESSION OLEPUBLIC
IMPLEMENTS _IChilkatEvents IN "Chilkat.Secrets"

PROCEDURE _IChilkatEvents_AbortCheck(abort As Number)
? "AbortCheck"
ENDPROC

* The BinaryData event is defunct: it is deprecated and is never called.
* The procedure must exist because the interface declares it, but it can be left empty.
PROCEDURE _IChilkatEvents_BinaryData(data As Variant)
ENDPROC

PROCEDURE _IChilkatEvents_PercentDone(pctDone As Number, abort As Number)
? "PercentDone"
ENDPROC

PROCEDURE _IChilkatEvents_ProgressInfo(name As String, value As String)
? "ProgressInfo"
ENDPROC

PROCEDURE _IChilkatEvents_TaskCompleted(task As Generic)
? "TaskCompleted"
ENDPROC

* The TextData event is defunct: it is deprecated and is never called.
* The procedure must exist because the interface declares it, but it can be left empty.
PROCEDURE _IChilkatEvents_TextData(data As String)
ENDPROC


ENDDEFINE
```

### Secrets.AbortCheck (event)

`Chilkat 11.7.0 · foxpro · Secrets · AbortCheck · event`

```foxpro
AbortCheck(abort As Number)
```

Enables a method call to be aborted by triggering the AbortCheck event at intervals defined by the `HeartbeatMs` property. If HeartbeatMs is set to its default value of 0, no events will occur. For instance, set HeartbeatMs to 200 to trigger 5 AbortCheck events per second.

**FoxPro event implementation:**

```foxpro
* Add to the MySecretsEvents class shown in the Events overview above.
PROCEDURE _IChilkatEvents_AbortCheck(abort As Number)
    * Set abort to 1 to abort the method in progress.
ENDPROC
```

### Secrets.PercentDone (event)

`Chilkat 11.7.0 · foxpro · Secrets · PercentDone · event`

```foxpro
PercentDone(pctDone As Number, abort As Number)
```

This provides the percentage completion for any method involving network communications or time-consuming processing, assuming the progress can be measured as a percentage. This event is triggered only when it's possible and logical to express the operation's progress as a percentage. The `pctDone` argument will range from 1 to 100. For methods that finish quickly, the number of PercentDone callbacks may vary, but the final callback will have `pctDone` equal to 100. For longer operations, callbacks will not exceed one per percentage point (e.g., 1, 2, 3, ..., 98, 99, 100).

The PercentDone callback also acts as an `AbortCheck` event. For fast methods where PercentDone fires, an AbortCheck event may not trigger since the PercentDone callback already provides an opportunity to abort. For longer operations, where time between PercentDone callbacks is extended, AbortCheck callbacks enable more responsive operation termination.

To abort the operation, set the `abort` output argument to `1`. This will cause the method to terminate and return a failure status or corresponding failure value.

**FoxPro event implementation:**

```foxpro
* Add to the MySecretsEvents class shown in the Events overview above.
PROCEDURE _IChilkatEvents_PercentDone(pctDone As Number, abort As Number)
    * pctDone ranges from 1 to 100.  Set abort to 1 to abort the method in progress.
ENDPROC
```

### Secrets.ProgressInfo (event)

`Chilkat 11.7.0 · foxpro · Secrets · ProgressInfo · event`

```foxpro
ProgressInfo(name As String, value As String)
```

This event callback provides `tag name`/value pairs that detail what occurs during a method call. To discover existing tag names, create code to handle the event, emit the pairs, and review them. Most tag names are self-explanatory.

Note: Some Chilkat methods don't fire any ProgressInfo events.

**FoxPro event implementation:**

```foxpro
* Add to the MySecretsEvents class shown in the Events overview above.
PROCEDURE _IChilkatEvents_ProgressInfo(name As String, value As String)
    ? name + ": " + value
ENDPROC
```

### Secrets.TaskCompleted (event)

`Chilkat 11.7.0 · foxpro · Secrets · TaskCompleted · event`

```foxpro
TaskCompleted(task As ChilkatTask)
```

Called from the background thread when an asynchronous task completes.

**FoxPro event implementation:**

```foxpro
* Add to the MySecretsEvents class shown in the Events overview above.
PROCEDURE _IChilkatEvents_TaskCompleted(task As Generic)
    * task is the Task object that has completed.
ENDPROC
```

## Async variants

Each returns a `Task` instead of the result and takes the same arguments as the synchronous method; run the task, wait for `Finished`, then read the result from the task. No new Async methods are added from 11.7.0 on.

```foxpro
DeleteSecretAsync(jsonId As ChilkatJsonObject) As ChilkatTask
GetSecretBdAsync(jsonId As ChilkatJsonObject, bd As ChilkatBinData) As ChilkatTask
GetSecretJsonAsync(jsonId As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As ChilkatTask
GetSecretSbAsync(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As ChilkatTask
GetSecretStrAsync(jsonId As ChilkatJsonObject) As ChilkatTask
ListSecretsAsync(json As ChilkatJsonObject, jsonOut As ChilkatJsonObject) As ChilkatTask
UpdateSecretBdAsync(jsonId As ChilkatJsonObject, secret As ChilkatBinData) As ChilkatTask
UpdateSecretJsonAsync(jsonId As ChilkatJsonObject, secret As ChilkatJsonObject) As ChilkatTask
UpdateSecretSbAsync(jsonId As ChilkatJsonObject, sb As ChilkatStringBuilder) As ChilkatTask
UpdateSecretStrAsync(jsonId As ChilkatJsonObject, secret As String) As ChilkatTask
```

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/foxpro/classes/BinData.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/foxpro/classes/JsonObject.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/foxpro/classes/StringBuilder.md)

