Sample code for 30+ languages & platforms
Visual FoxPro

Use a Certificate Vault for Chain Building

See more PFX/P12 Examples

Demonstrates Pfx.UseCertVault, which adds the certificates in an XmlCertVault to the set of sources available for later chain-building operations such as AddCert.

The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.

Background. The call captures a point-in-time snapshot of the vault's certificates. Providing extra intermediate certificates lets Chilkat complete certificate chains when building a PFX.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loPfx
LOCAL loVault

lnSuccess = 0

loPfx = CreateObject('Chilkat.Pfx')

*  The file path is relative to the application's current working directory.  An absolute path
*  may also be used.  Supply the path appropriate to your own environment.
*  Load additional certificates (such as intermediate CA certificates) into a certificate vault.
loVault = CreateObject('Chilkat.XmlCertVault')
lnSuccess = loVault.AddCertFile("qa_data/intermediate_ca.cer")
IF (lnSuccess = 0) THEN
    ? loVault.LastErrorText
    RELEASE loPfx
    RELEASE loVault
    CANCEL
ENDIF

*  Make the vault's certificates available as sources for later chain-building operations, such as
*  AddCert.  The call captures a point-in-time snapshot of the vault's certificates.
lnSuccess = loPfx.UseCertVault(loVault)
IF (lnSuccess = 0) THEN
    ? loPfx.LastErrorText
    RELEASE loPfx
    RELEASE loVault
    CANCEL
ENDIF

? "Certificate vault registered as a chain-building source."

RELEASE loPfx
RELEASE loVault