---
product: Chilkat
product_version: 11.7.0
language: delphidll
language_label: Delphi DLL
class: Secrets
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/dd_CkSecretsRef.html
---
# Chilkat Secrets — Delphi DLL — v11.7.0

> Chilkat 11.7.0 · language=delphidll · 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/delphidll/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

**Create/Dispose**

```pascal
var
myObject: HCkSecrets;

begin
myObject := CkSecrets_Create();

// ...

CkSecrets_Dispose(myObject);
end;
```

`function CkSecrets_Create: HCkSecrets; stdcall;`

Creates an instance of the HCkSecrets object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

`procedure CkSecrets_Dispose(handle: HCkSecrets); stdcall;`

Objects created by calling CkSecrets_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

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 Delphi DLL.

## 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` | `procedure CkSecrets_getDebugLogFilePath(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; procedure CkSecrets_putDebugLogFilePath(objHandle: HCkSecrets; newPropVal: PWideChar); stdcall; function CkSecrets__debugLogFilePath(objHandle: HCkSecrets): PWideChar; stdcall;` | 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` | `procedure CkSecrets_getLastErrorHtml(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; function CkSecrets__lastErrorHtml(objHandle: HCkSecrets): PWideChar; stdcall;` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `procedure CkSecrets_getLastErrorText(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; function CkSecrets__lastErrorText(objHandle: HCkSecrets): PWideChar; stdcall;` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `procedure CkSecrets_getLastErrorXml(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; function CkSecrets__lastErrorXml(objHandle: HCkSecrets): PWideChar; stdcall;` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `function CkSecrets_getLastMethodSuccess(objHandle: HCkSecrets): wordbool; stdcall; procedure CkSecrets_putLastMethodSuccess(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `function CkSecrets_getVerboseLogging(objHandle: HCkSecrets): wordbool; stdcall; procedure CkSecrets_putVerboseLogging(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `procedure CkSecrets_getVersion(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; function CkSecrets__version(objHandle: HCkSecrets): PWideChar; stdcall;` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AutoSplit` | property, read/write | `function CkSecrets_getAutoSplit(objHandle: HCkSecrets): wordbool; stdcall; procedure CkSecrets_putAutoSplit(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;` |
| `Compression` | property, read/write | `function CkSecrets_getCompression(objHandle: HCkSecrets): wordbool; stdcall; procedure CkSecrets_putCompression(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;` |
| `Location` | property, read/write | `procedure CkSecrets_getLocation(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; procedure CkSecrets_putLocation(objHandle: HCkSecrets; newPropVal: PWideChar); stdcall; function CkSecrets__location(objHandle: HCkSecrets): PWideChar; stdcall;` |
| `UncommonOptions` | property, read/write | `procedure CkSecrets_getUncommonOptions(objHandle: HCkSecrets; outPropVal: HCkString); stdcall; procedure CkSecrets_putUncommonOptions(objHandle: HCkSecrets; newPropVal: PWideChar); stdcall; function CkSecrets__uncommonOptions(objHandle: HCkSecrets): PWideChar; stdcall;` |
| `DeleteSecret` | method | `function CkSecrets_DeleteSecret(objHandle: HCkSecrets;     jsonId: HCkJsonObject): wordbool; stdcall;` |
| `GetSecretBd` | method | `function CkSecrets_GetSecretBd(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     bd: HCkBinData): wordbool; stdcall;` |
| `GetSecretJson` | method | `function CkSecrets_GetSecretJson(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     jsonOut: HCkJsonObject): wordbool; stdcall;` |
| `GetSecretSb` | method | `function CkSecrets_GetSecretSb(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     sb: HCkStringBuilder): wordbool; stdcall;` |
| `GetSecretStr` | method | `function CkSecrets_GetSecretStr(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     outStr: HCkString): wordbool; stdcall; function CkSecrets__getSecretStr(objHandle: HCkSecrets;     jsonId: HCkJsonObject): PWideChar; stdcall;` |
| `ListSecrets` | method | `function CkSecrets_ListSecrets(objHandle: HCkSecrets;     json: HCkJsonObject;     jsonOut: HCkJsonObject): wordbool; stdcall;` |
| `SecretSpecToJson` | method | `function CkSecrets_SecretSpecToJson(objHandle: HCkSecrets;     secretSpec: PWideChar;     json: HCkJsonObject): wordbool; stdcall;` |
| `SetBootstrapSecret` | method | `function CkSecrets_SetBootstrapSecret(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     secretContent: HCkSecrets): wordbool; stdcall;` |
| `UpdateSecretBd` | method | `function CkSecrets_UpdateSecretBd(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     secret: HCkBinData): wordbool; stdcall;` |
| `UpdateSecretJson` | method | `function CkSecrets_UpdateSecretJson(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     secret: HCkJsonObject): wordbool; stdcall;` |
| `UpdateSecretSb` | method | `function CkSecrets_UpdateSecretSb(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     sb: HCkStringBuilder): wordbool; stdcall;` |
| `UpdateSecretStr` | method | `function CkSecrets_UpdateSecretStr(objHandle: HCkSecrets;     jsonId: HCkJsonObject;     secret: PWideChar): wordbool; stdcall;` |

## Properties

### Secrets.AutoSplit

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

```pascal
function CkSecrets_getAutoSplit(objHandle: HCkSecrets): wordbool; stdcall;
procedure CkSecrets_putAutoSplit(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;
```

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 `True`.

### Secrets.Compression

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

```pascal
function CkSecrets_getCompression(objHandle: HCkSecrets): wordbool; stdcall;
procedure CkSecrets_putCompression(objHandle: HCkSecrets; newPropVal: wordbool); stdcall;
```

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

### Secrets.Location

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

```pascal
procedure CkSecrets_getLocation(objHandle: HCkSecrets; outPropVal: HCkString); stdcall;
procedure CkSecrets_putLocation(objHandle: HCkSecrets; newPropVal: PWideChar); stdcall;
function CkSecrets__location(objHandle: HCkSecrets): PWideChar; stdcall;
```

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 · delphidll · Secrets · UncommonOptions · property · read/write · since 10.1.0`

```pascal
procedure CkSecrets_getUncommonOptions(objHandle: HCkSecrets; outPropVal: HCkString); stdcall;
procedure CkSecrets_putUncommonOptions(objHandle: HCkSecrets; newPropVal: PWideChar); stdcall;
function CkSecrets__uncommonOptions(objHandle: HCkSecrets): PWideChar; stdcall;
```

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 · delphidll · Secrets · DeleteSecret · method · since 10.1.0`

```pascal
function CkSecrets_DeleteSecret(objHandle: HCkSecrets;
    jsonId: HCkJsonObject): wordbool; stdcall;
```

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

Returns True for success, False for failure.

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

### Secrets.GetSecretBd

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

```pascal
function CkSecrets_GetSecretBd(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    bd: HCkBinData): wordbool; stdcall;
```

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

Returns True for success, False for failure.

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

### Secrets.GetSecretJson

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

```pascal
function CkSecrets_GetSecretJson(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    jsonOut: HCkJsonObject): wordbool; stdcall;
```

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

Returns True for success, False for failure.

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

### Secrets.GetSecretSb

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

```pascal
function CkSecrets_GetSecretSb(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    sb: HCkStringBuilder): wordbool; stdcall;
```

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

Returns True for success, False for failure.

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

### Secrets.GetSecretStr

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

```pascal
function CkSecrets_GetSecretStr(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    outStr: HCkString): wordbool; stdcall;
function CkSecrets__getSecretStr(objHandle: HCkSecrets;
    jsonId: HCkJsonObject): PWideChar; stdcall;
```

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

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

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

### Secrets.ListSecrets

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

```pascal
function CkSecrets_ListSecrets(objHandle: HCkSecrets;
    json: HCkJsonObject;
    jsonOut: HCkJsonObject): wordbool; stdcall;
```

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

Returns True for success, False for failure.

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

### Secrets.SecretSpecToJson

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

```pascal
function CkSecrets_SecretSpecToJson(objHandle: HCkSecrets;
    secretSpec: PWideChar;
    json: HCkJsonObject): wordbool; stdcall;
```

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 True for success, False for failure.

### Secrets.SetBootstrapSecret

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

```pascal
function CkSecrets_SetBootstrapSecret(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secretContent: HCkSecrets): wordbool; stdcall;
```

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 True for success, False for failure.

### Secrets.UpdateSecretBd

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

```pascal
function CkSecrets_UpdateSecretBd(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: HCkBinData): wordbool; stdcall;
```

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 True for success, False for failure.

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

### Secrets.UpdateSecretJson

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

```pascal
function CkSecrets_UpdateSecretJson(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: HCkJsonObject): wordbool; stdcall;
```

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 True for success, False for failure.

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

### Secrets.UpdateSecretSb

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

```pascal
function CkSecrets_UpdateSecretSb(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    sb: HCkStringBuilder): wordbool; stdcall;
```

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 True for success, False for failure.

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

### Secrets.UpdateSecretStr

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

```pascal
function CkSecrets_UpdateSecretStr(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: PWideChar): wordbool; stdcall;
```

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 True for success, False for failure.

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

## Events and callbacks

### Secrets.AbortCheck (event)

`Chilkat 11.7.0 · delphidll · Secrets · AbortCheck · event`

```pascal
function MyAbortCheck(): Integer; cdecl;
```

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. Return `True` to abort; return `False` to continue (not abort)

### Secrets.PercentDone (event)

`Chilkat 11.7.0 · delphidll · Secrets · PercentDone · event`

```pascal
function MyPercentDone(pctDone: Integer): Integer; cdecl;
```

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.

Return `True` to abort; return `False` to continue (not abort)

### Secrets.ProgressInfo (event)

`Chilkat 11.7.0 · delphidll · Secrets · ProgressInfo · event`

```pascal
procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
```

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.

### Secrets.TaskCompleted (event)

`Chilkat 11.7.0 · delphidll · Secrets · TaskCompleted · event`

```pascal
procedure MyTaskCompleted(task: HCkTask) cdecl;
```

Called from the background thread when an asynchronous task completes.

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

```pascal
function CkSecrets_DeleteSecretAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject): HCkTask; stdcall;
function CkSecrets_GetSecretBdAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    bd: HCkBinData): HCkTask; stdcall;
function CkSecrets_GetSecretJsonAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    jsonOut: HCkJsonObject): HCkTask; stdcall;
function CkSecrets_GetSecretSbAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    sb: HCkStringBuilder): HCkTask; stdcall;
function CkSecrets_GetSecretStrAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject): HCkTask; stdcall;
function CkSecrets_ListSecretsAsync(objHandle: HCkSecrets;
    json: HCkJsonObject;
    jsonOut: HCkJsonObject): HCkTask; stdcall;
function CkSecrets_UpdateSecretBdAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: HCkBinData): HCkTask; stdcall;
function CkSecrets_UpdateSecretJsonAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: HCkJsonObject): HCkTask; stdcall;
function CkSecrets_UpdateSecretSbAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    sb: HCkStringBuilder): HCkTask; stdcall;
function CkSecrets_UpdateSecretStrAsync(objHandle: HCkSecrets;
    jsonId: HCkJsonObject;
    secret: PWideChar): HCkTask; stdcall;
```

## Related classes

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

