---
product: Chilkat
product_version: 11.7.0
language: ckperl
language_label: Perl
class: XmlCertVault
class_name: CkXmlCertVault
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/perlCkXmlCertVaultRef.html
---
# Chilkat XmlCertVault — Perl — v11.7.0

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

## Purpose

**Collect certificates, certificate chains, PEM data, and PFX private keys in an XML vault.**

`Chilkat.XmlCertVault` stores certificates and private-key material in a portable XML-based certificate vault. It can add individual certificates, certificate chains, DER or encoded certificates, PEM files, certificate strings, and PFX/PKCS12 data from files, memory, encoded text, or existing Chilkat objects. The vault can then be exported as XML, loaded from XML, or saved to an XML file for later reuse by other Chilkat certificate and TLS workflows.

**Add certificates**

Add certificates from `Cert` objects, files, PEM strings, binary DER bytes, or encoded data such as Base64 or hex.

**Add certificate chains**

Import an entire `CertChain` when related issuer and intermediate certificates should be kept together in the vault.

**Add PEM content**

Load PEM files containing one or more certificates and/or private keys, including encrypted PEM content when a password is supplied.

**Add PFX / PKCS12**

Add PFX data from a `Pfx` object, file, byte array, or encoded string, using the PFX password to import private-key material.

**Master password protection**

Use `MasterPassword` to protect access to private keys stored in the vault.

**Load and save XML**

Export the vault with `GetXml`, load it with `LoadXml` or `LoadXmlFile`, and persist it with `SaveXml`.

**Common pattern:** Create an `XmlCertVault`, set `MasterPassword` when the vault will contain private keys, add certificates or PFX/PEM material, then save the vault with `SaveXml` or keep the XML string from `GetXml`. Later, reload the same vault with `LoadXml` or `LoadXmlFile` and provide the same master password before using private keys.

**Security note:** Certificates are stored unencrypted, but private keys are stored using 256-bit AES encryption. The individual PFX passwords are also stored encrypted with the vault's `MasterPassword`, which is required to access any private keys contained in the XML vault.

## Object creation, unlocking and error handling

**Object Creation**

```perl
$obj = chilkat::CkXmlCertVault->new();
```

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

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` | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_DebugLogFilePath($ckStr); $strVal = $xmlCertVault->debugLogFilePath(); $xmlCertVault->put_DebugLogFilePath($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` | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_LastErrorHtml($ckStr); $strVal = $xmlCertVault->lastErrorHtml();` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_LastErrorText($ckStr); $strVal = $xmlCertVault->lastErrorText();` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_LastErrorXml($ckStr); $strVal = $xmlCertVault->lastErrorXml();` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `# $boolVal is a boolean $boolVal = $xmlCertVault->get_LastMethodSuccess(); $xmlCertVault->put_LastMethodSuccess($boolVal);` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `Utf8` | `# $boolVal is a boolean $boolVal = $xmlCertVault->get_Utf8(); $xmlCertVault->put_Utf8($boolVal);` | read/write | When set to `1`, all `string` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `# $boolVal is a boolean $boolVal = $xmlCertVault->get_VerboseLogging(); $xmlCertVault->put_VerboseLogging($boolVal);` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_Version($ckStr); $strVal = $xmlCertVault->version();` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `MasterPassword` | property, read/write | `# $strVal is a string # $ckStr is a CkString $xmlCertVault->get_MasterPassword($ckStr); $strVal = $xmlCertVault->masterPassword(); $xmlCertVault->put_MasterPassword($strVal);` |
| `AddCert` | method | `# $cert is a CkCert $status = $xmlCertVault->AddCert($cert);` |
| `AddCertChain` | method | `# $certChain is a CkCertChain $status = $xmlCertVault->AddCertChain($certChain);` |
| `AddCertEncoded` | method | `# $encodedBytes is a string # $encoding is a string $status = $xmlCertVault->AddCertEncoded($encodedBytes, $encoding);` |
| `AddCertFile` | method | `# $path is a string $status = $xmlCertVault->AddCertFile($path);` |
| `AddCertString` | method | `# $certData is a string $status = $xmlCertVault->AddCertString($certData);` |
| `AddPemFile` | method | `# $path is a string # $password is a string $status = $xmlCertVault->AddPemFile($path, $password);` |
| `AddPfx` | method | `# $pfx is a CkPfx $status = $xmlCertVault->AddPfx($pfx);` |
| `AddPfxEncoded` | method | `# $encodedBytes is a string # $encoding is a string # $password is a string $status = $xmlCertVault->AddPfxEncoded($encodedBytes, $encoding, $password);` |
| `AddPfxFile` | method | `# $path is a string # $password is a string $status = $xmlCertVault->AddPfxFile($path, $password);` |
| `GetXml` | method | `# $outStr is a CkString (output) $status = $xmlCertVault->GetXml($outStr); $retStr = $xmlCertVault->getXml();` |
| `LoadXml` | method | `# $xml is a string $status = $xmlCertVault->LoadXml($xml);` |
| `LoadXmlFile` | method | `# $path is a string $status = $xmlCertVault->LoadXmlFile($path);` |
| `SaveXml` | method | `# $path is a string $status = $xmlCertVault->SaveXml($path);` |

Deprecated members are listed at the end of this file with their replacements; do not use them in new code.

## Properties

### XmlCertVault.MasterPassword

`Chilkat 11.7.0 · ckperl · XmlCertVault · MasterPassword · property · read/write · since 9.5.0.40`

```perl
# $strVal is a string

# $ckStr is a CkString

$xmlCertVault->get_MasterPassword($ckStr);

$strVal = $xmlCertVault->masterPassword();

$xmlCertVault->put_MasterPassword($strVal);
```

The master password for the vault. Certificates are stored unencrypted, but private keys are stored 256-bit AES encrypted using the individual PFX passwords. The PFX passwords are stored 256-bit AES encrypted using the master password. The master password is required to acces any of the private keys stored within the XML vault.

## Methods

### XmlCertVault.AddCert

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddCert · method · since 9.5.0.40`

```perl
# $cert is a CkCert

$status = $xmlCertVault->AddCert($cert);
```

Adds a certificate to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertChain

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddCertChain · method · since 9.5.0.40`

```perl
# $certChain is a CkCertChain

$status = $xmlCertVault->AddCertChain($certChain);
```

Adds a chain of certificates to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertEncoded

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddCertEncoded · method · since 9.5.0.40`

```perl
# $encodedBytes is a string

# $encoding is a string

$status = $xmlCertVault->AddCertEncoded($encodedBytes, $encoding);
```

Adds a certificate to the XML vault where certificate is passed directly from encoded bytes (such as Base64, Hex, etc.). The encoding is indicated by `encoding`.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertFile

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddCertFile · method · since 9.5.0.40`

```perl
# $path is a string

$status = $xmlCertVault->AddCertFile($path);
```

Adds a certificate to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertString

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddCertString · method · since 9.5.0.40`

```perl
# $certData is a string

$status = $xmlCertVault->AddCertString($certData);
```

Adds a certificate from any string representation format such as PEM.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPemFile

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddPemFile · method · since 9.5.0.40`

```perl
# $path is a string

# $password is a string

$status = $xmlCertVault->AddPemFile($path, $password);
```

Adds the contents of a PEM file to the XML vault. The PEM file may be encrypted, and it may contain one or more certificates and/or private keys. The password is optional and only required if the PEM file contains encrypted content that requires a password.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPfx

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddPfx · method · since 9.5.0.40`

```perl
# $pfx is a CkPfx

$status = $xmlCertVault->AddPfx($pfx);
```

Adds a PFX (PKCS12) to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPfxEncoded

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddPfxEncoded · method`

```perl
# $encodedBytes is a string

# $encoding is a string

# $password is a string

$status = $xmlCertVault->AddPfxEncoded($encodedBytes, $encoding, $password);
```

Adds a PFX to the XML vault where PFX is passed directly from encoded bytes (such as Base64, Hex, etc.). The encoding is indicated by `encoding`.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPfxFile

`Chilkat 11.7.0 · ckperl · XmlCertVault · AddPfxFile · method · since 9.5.0.40`

```perl
# $path is a string

# $password is a string

$status = $xmlCertVault->AddPfxFile($path, $password);
```

Adds a PFX file to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.GetXml

`Chilkat 11.7.0 · ckperl · XmlCertVault · GetXml · method · since 9.5.0.40`

```perl
# $outStr is a CkString (output)

$status = $xmlCertVault->GetXml($outStr);

$retStr = $xmlCertVault->getXml();
```

Returns the contents of the cert vault as an XML string.

Returns 1 for success, 0 for failure.

### XmlCertVault.LoadXml

`Chilkat 11.7.0 · ckperl · XmlCertVault · LoadXml · method · since 9.5.0.40`

```perl
# $xml is a string

$status = $xmlCertVault->LoadXml($xml);
```

Loads from an XML string.

Returns 1 for success, 0 for failure.

### XmlCertVault.LoadXmlFile

`Chilkat 11.7.0 · ckperl · XmlCertVault · LoadXmlFile · method · since 9.5.0.40`

```perl
# $path is a string

$status = $xmlCertVault->LoadXmlFile($path);
```

Loads from an XML file.

Returns 1 for success, 0 for failure.

### XmlCertVault.SaveXml

`Chilkat 11.7.0 · ckperl · XmlCertVault · SaveXml · method · since 9.5.0.40`

```perl
# $path is a string

$status = $xmlCertVault->SaveXml($path);
```

Saves the contents to an XML file.

Returns 1 for success, 0 for failure.

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `AddCertBinary` | method | before 11.6.1 | — |
| `AddPfxBinary` | method | before 11.6.1 | — |

## Related classes

[`Cert`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckperl/classes/Cert.md), [`CertChain`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckperl/classes/CertChain.md), [`Pfx`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckperl/classes/Pfx.md)

