---
product: Chilkat
product_version: 11.7.0
language: asp
language_label: Classic ASP
class: XmlCertVault
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/asp_XmlCertVaultRef.html
---
# Chilkat XmlCertVault — Classic ASP — v11.7.0

> Chilkat 11.7.0 · language=asp · class=XmlCertVault
> 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/asp/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**

```visual-basic
set xmlCertVault = Server.CreateObject("Chilkat.XmlCertVault")

' ... use xmlCertVault ...

set xmlCertVault = Nothing
```

Classic ASP creates Chilkat objects with `Server.CreateObject`. The registered Chilkat ActiveX must match the bitness of the IIS application pool: a pool with *Enable 32-Bit Applications* set to True needs the 32-bit ActiveX, otherwise the 64-bit ActiveX. To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `Server.CreateObject("Chilkat.XmlCertVault.11")` for Chilkat v11.\*.\*.

VBScript requires `set` when assigning an object, so the signatures on this page show `set x = obj.Method(...)` for methods that return a Chilkat object; test the result with `Is Nothing`, since a method that fails to return an object returns `Nothing`. A method with no return value is called as a statement without parentheses (`obj.Method arg1, arg2`). Boolean properties, arguments and return values are integers in the ActiveX: pass `1` or `0`, and test success with `= 1`. Byte arrays are Variant arrays and can be sent with `Response.BinaryWrite`. Asynchronous (*\*Async*) methods and event callbacks are not used from Classic ASP.

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 Classic ASP.

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` | `xmlCertVault.DebugLogFilePath ' 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` | `xmlCertVault.LastBinaryResult ' 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` | `xmlCertVault.LastErrorHtml ' String (read-only)` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `xmlCertVault.LastErrorText ' String (read-only)` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `xmlCertVault.LastErrorXml ' String (read-only)` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `xmlCertVault.LastMethodSuccess ' Long` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `LastStringResult` | `xmlCertVault.LastStringResult ' 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` | `xmlCertVault.LastStringResultLen ' Long (read-only)` | read-only | The length, in characters, of the string contained in the LastStringResult property. |
| `VerboseLogging` | `xmlCertVault.VerboseLogging ' Long` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `xmlCertVault.Version ' String (read-only)` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `MasterPassword` | property, read/write | `xmlCertVault.MasterPassword ' String` |
| `AddCert` | method | `success = xmlCertVault.AddCert(cert) ' Long (1/0)` |
| `AddCertBinary` | method | `success = xmlCertVault.AddCertBinary(certBytes) ' Long (1/0)` |
| `AddCertChain` | method | `success = xmlCertVault.AddCertChain(certChain) ' Long (1/0)` |
| `AddCertEncoded` | method | `success = xmlCertVault.AddCertEncoded(encodedBytes, encoding) ' Long (1/0)` |
| `AddCertFile` | method | `success = xmlCertVault.AddCertFile(path) ' Long (1/0)` |
| `AddCertString` | method | `success = xmlCertVault.AddCertString(certData) ' Long (1/0)` |
| `AddPemFile` | method | `success = xmlCertVault.AddPemFile(path, password) ' Long (1/0)` |
| `AddPfx` | method | `success = xmlCertVault.AddPfx(pfx) ' Long (1/0)` |
| `AddPfxBinary` | method | `success = xmlCertVault.AddPfxBinary(pfxBytes, password) ' Long (1/0)` |
| `AddPfxEncoded` | method | `success = xmlCertVault.AddPfxEncoded(encodedBytes, encoding, password) ' Long (1/0)` |
| `AddPfxFile` | method | `success = xmlCertVault.AddPfxFile(path, password) ' Long (1/0)` |
| `GetXml` | method | `str = xmlCertVault.GetXml() ' String` |
| `LoadXml` | method | `success = xmlCertVault.LoadXml(xml) ' Long (1/0)` |
| `LoadXmlFile` | method | `success = xmlCertVault.LoadXmlFile(path) ' Long (1/0)` |
| `SaveXml` | method | `success = xmlCertVault.SaveXml(path) ' Long (1/0)` |

## Properties

### XmlCertVault.MasterPassword

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

```visual-basic
xmlCertVault.MasterPassword  ' String
```

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 · asp · XmlCertVault · AddCert · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddCert(cert)  ' Long (1/0)
```

Adds a certificate to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertBinary

`Chilkat 11.7.0 · asp · XmlCertVault · AddCertBinary · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddCertBinary(certBytes)  ' Long (1/0)
```

Adds a certificate to the XML vault from any binary format, such as DER.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertChain

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

```visual-basic
success = xmlCertVault.AddCertChain(certChain)  ' Long (1/0)
```

Adds a chain of certificates to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertEncoded

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

```visual-basic
success = xmlCertVault.AddCertEncoded(encodedBytes, encoding)  ' Long (1/0)
```

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 · asp · XmlCertVault · AddCertFile · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddCertFile(path)  ' Long (1/0)
```

Adds a certificate to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddCertString

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

```visual-basic
success = xmlCertVault.AddCertString(certData)  ' Long (1/0)
```

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

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPemFile

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

```visual-basic
success = xmlCertVault.AddPemFile(path, password)  ' Long (1/0)
```

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 · asp · XmlCertVault · AddPfx · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddPfx(pfx)  ' Long (1/0)
```

Adds a PFX (PKCS12) to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPfxBinary

`Chilkat 11.7.0 · asp · XmlCertVault · AddPfxBinary · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddPfxBinary(pfxBytes, password)  ' Long (1/0)
```

Adds a PFX to the XML vault where PFX is passed directly from in-memory binary bytes.

Returns 1 for success, 0 for failure.

### XmlCertVault.AddPfxEncoded

`Chilkat 11.7.0 · asp · XmlCertVault · AddPfxEncoded · method`

```visual-basic
success = xmlCertVault.AddPfxEncoded(encodedBytes, encoding, password)  ' Long (1/0)
```

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 · asp · XmlCertVault · AddPfxFile · method · since 9.5.0.40`

```visual-basic
success = xmlCertVault.AddPfxFile(path, password)  ' Long (1/0)
```

Adds a PFX file to the XML vault.

Returns 1 for success, 0 for failure.

### XmlCertVault.GetXml

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

```visual-basic
str = xmlCertVault.GetXml()  ' String
```

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

Returns `Nothing` on failure

### XmlCertVault.LoadXml

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

```visual-basic
success = xmlCertVault.LoadXml(xml)  ' Long (1/0)
```

Loads from an XML string.

Returns 1 for success, 0 for failure.

### XmlCertVault.LoadXmlFile

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

```visual-basic
success = xmlCertVault.LoadXmlFile(path)  ' Long (1/0)
```

Loads from an XML file.

Returns 1 for success, 0 for failure.

### XmlCertVault.SaveXml

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

```visual-basic
success = xmlCertVault.SaveXml(path)  ' Long (1/0)
```

Saves the contents to an XML file.

Returns 1 for success, 0 for failure.

## Related classes

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

