---
product: Chilkat
product_version: 11.7.0
language: wc
language_label: Unicode C
class: Secrets
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/wc_CkSecretsWRef.html
---
# Chilkat Secrets — Unicode C — v11.7.0

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

```c
HCkSecretsW instance = CkSecretsW_Create();
// ...
CkSecretsW_Dispose(instance);
```

`HCkSecretsW CkSecretsW_Create(void);`

Creates an instance of the HCkSecretsW object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkSecretsW_Dispose(HCkSecretsW handle);`

Objects created by calling CkSecretsW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkSecretsW_Dispose.

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 Unicode C.

## 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` | `void CkSecretsW_getDebugLogFilePath(HCkSecretsW cHandle, HCkString retval); void CkSecretsW_putDebugLogFilePath(HCkSecretsW cHandle, const wchar_t *newVal); const wchar_t *CkSecretsW_debugLogFilePath(HCkSecretsW cHandle);` | 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` | `void CkSecretsW_getLastErrorHtml(HCkSecretsW cHandle, HCkString retval); const wchar_t *CkSecretsW_lastErrorHtml(HCkSecretsW cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkSecretsW_getLastErrorText(HCkSecretsW cHandle, HCkString retval); const wchar_t *CkSecretsW_lastErrorText(HCkSecretsW cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkSecretsW_getLastErrorXml(HCkSecretsW cHandle, HCkString retval); const wchar_t *CkSecretsW_lastErrorXml(HCkSecretsW cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkSecretsW_getLastMethodSuccess(HCkSecretsW cHandle); void CkSecretsW_putLastMethodSuccess(HCkSecretsW cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `VerboseLogging` | `BOOL CkSecretsW_getVerboseLogging(HCkSecretsW cHandle); void CkSecretsW_putVerboseLogging(HCkSecretsW cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkSecretsW_getVersion(HCkSecretsW cHandle, HCkString retval); const wchar_t *CkSecretsW_version(HCkSecretsW cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AutoSplit` | property, read/write | `BOOL CkSecretsW_getAutoSplit(HCkSecretsW cHandle); void CkSecretsW_putAutoSplit(HCkSecretsW cHandle, BOOL newVal);` |
| `Compression` | property, read/write | `BOOL CkSecretsW_getCompression(HCkSecretsW cHandle); void CkSecretsW_putCompression(HCkSecretsW cHandle, BOOL newVal);` |
| `Location` | property, read/write | `void CkSecretsW_getLocation(HCkSecretsW cHandle, HCkString retval); void CkSecretsW_putLocation(HCkSecretsW cHandle, const wchar_t *newVal); const wchar_t *CkSecretsW_location(HCkSecretsW cHandle);` |
| `UncommonOptions` | property, read/write | `void CkSecretsW_getUncommonOptions(HCkSecretsW cHandle, HCkString retval); void CkSecretsW_putUncommonOptions(HCkSecretsW cHandle, const wchar_t *newVal); const wchar_t *CkSecretsW_uncommonOptions(HCkSecretsW cHandle);` |
| `DeleteSecret` | method | `BOOL CkSecretsW_DeleteSecret(HCkSecretsW cHandle, HCkJsonObjectW jsonId);` |
| `GetSecretBd` | method | `BOOL CkSecretsW_GetSecretBd(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW bd);` |
| `GetSecretJson` | method | `BOOL CkSecretsW_GetSecretJson(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW jsonOut);` |
| `GetSecretSb` | method | `BOOL CkSecretsW_GetSecretSb(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);` |
| `GetSecretStr` | method | `BOOL CkSecretsW_GetSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId, const wchar_t *outStr); const wchar_t *CkSecretsW_getSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId);` |
| `ListSecrets` | method | `BOOL CkSecretsW_ListSecrets(HCkSecretsW cHandle, HCkJsonObjectW json, HCkJsonObjectW jsonOut);` |
| `SecretSpecToJson` | method | `BOOL CkSecretsW_SecretSpecToJson(HCkSecretsW cHandle, const wchar_t *secretSpec, HCkJsonObjectW json);` |
| `SetBootstrapSecret` | method | `BOOL CkSecretsW_SetBootstrapSecret(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkSecretsW secretContent);` |
| `UpdateSecretBd` | method | `BOOL CkSecretsW_UpdateSecretBd(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW secret);` |
| `UpdateSecretJson` | method | `BOOL CkSecretsW_UpdateSecretJson(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW secret);` |
| `UpdateSecretSb` | method | `BOOL CkSecretsW_UpdateSecretSb(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);` |
| `UpdateSecretStr` | method | `BOOL CkSecretsW_UpdateSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId, const wchar_t *secret);` |

## Properties

### Secrets.AutoSplit

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

```c
BOOL CkSecretsW_getAutoSplit(HCkSecretsW cHandle);
void CkSecretsW_putAutoSplit(HCkSecretsW cHandle, BOOL newVal);
```

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

```c
BOOL CkSecretsW_getCompression(HCkSecretsW cHandle);
void CkSecretsW_putCompression(HCkSecretsW cHandle, BOOL newVal);
```

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

```c
void CkSecretsW_getLocation(HCkSecretsW cHandle, HCkString retval);
void CkSecretsW_putLocation(HCkSecretsW cHandle, const wchar_t *newVal);
const wchar_t *CkSecretsW_location(HCkSecretsW cHandle);
```

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

```c
void CkSecretsW_getUncommonOptions(HCkSecretsW cHandle, HCkString retval);
void CkSecretsW_putUncommonOptions(HCkSecretsW cHandle, const wchar_t *newVal);
const wchar_t *CkSecretsW_uncommonOptions(HCkSecretsW cHandle);
```

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

```c
BOOL CkSecretsW_DeleteSecret(HCkSecretsW cHandle, HCkJsonObjectW jsonId);
```

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 · wc · Secrets · GetSecretBd · method · since 10.1.0`

```c
BOOL CkSecretsW_GetSecretBd(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW bd);
```

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 · wc · Secrets · GetSecretJson · method · since 10.1.0`

```c
BOOL CkSecretsW_GetSecretJson(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW jsonOut);
```

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 · wc · Secrets · GetSecretSb · method · since 10.1.0`

```c
BOOL CkSecretsW_GetSecretSb(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);
```

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 · wc · Secrets · GetSecretStr · method · since 10.1.0`

```c
BOOL CkSecretsW_GetSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId, const wchar_t *outStr);
const wchar_t *CkSecretsW_getSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId);
```

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

Returns TRUE for success, FALSE for failure.

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

### Secrets.ListSecrets

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

```c
BOOL CkSecretsW_ListSecrets(HCkSecretsW cHandle, HCkJsonObjectW json, HCkJsonObjectW jsonOut);
```

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 · wc · Secrets · SecretSpecToJson · method · since 11.5.0`

```c
BOOL CkSecretsW_SecretSpecToJson(HCkSecretsW cHandle, const wchar_t *secretSpec, HCkJsonObjectW json);
```

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 · wc · Secrets · SetBootstrapSecret · method · since 10.1.0`

```c
BOOL CkSecretsW_SetBootstrapSecret(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkSecretsW secretContent);
```

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 · wc · Secrets · UpdateSecretBd · method · since 10.1.0`

```c
BOOL CkSecretsW_UpdateSecretBd(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW secret);
```

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 · wc · Secrets · UpdateSecretJson · method · since 10.1.0`

```c
BOOL CkSecretsW_UpdateSecretJson(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW secret);
```

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 · wc · Secrets · UpdateSecretSb · method · since 10.1.0`

```c
BOOL CkSecretsW_UpdateSecretSb(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);
```

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 · wc · Secrets · UpdateSecretStr · method · since 10.1.0`

```c
BOOL CkSecretsW_UpdateSecretStr(HCkSecretsW cHandle, HCkJsonObjectW jsonId, const wchar_t *secret);
```

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

This binding delivers progress information through callbacks (AbortCheck, PercentDone, ProgressInfo, TaskCompleted) rather than events. See `guide.md` for how to attach them in Unicode C.

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

```c
HCkTaskW CkSecretsW_DeleteSecretAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId);
HCkTaskW CkSecretsW_GetSecretBdAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW bd);
HCkTaskW CkSecretsW_GetSecretJsonAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW jsonOut);
HCkTaskW CkSecretsW_GetSecretSbAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);
HCkTaskW CkSecretsW_GetSecretStrAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId);
HCkTaskW CkSecretsW_ListSecretsAsync(HCkSecretsW cHandle, HCkJsonObjectW json, HCkJsonObjectW jsonOut);
HCkTaskW CkSecretsW_UpdateSecretBdAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkBinDataW secret);
HCkTaskW CkSecretsW_UpdateSecretJsonAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkJsonObjectW secret);
HCkTaskW CkSecretsW_UpdateSecretSbAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, HCkStringBuilderW sb);
HCkTaskW CkSecretsW_UpdateSecretStrAsync(HCkSecretsW cHandle, HCkJsonObjectW jsonId, const wchar_t *secret);
```

## Related classes

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

