Skip to content

DFSEC_CertificateFree

Include: Use System\Security.pkg

See Also: Certificates, DFSEC_CertificateFromFile, DFSEC_CertificateFromString, cHttpClient.ClientCertificate

Purpose

Releases a certificate handle created by a certificate creation function.

Syntax

Procedure DFSEC_CertificateFree Global Handle hCertificate

Arguments

hCertificate : Nonzero certificate handle to release.

Behavior

DFSEC_CertificateFree releases a nonzero certificate handle. Passing 0 raises DFERR_BAD_PARAMETER.

Before freeing a handle that was assigned to a consumer, clear the consumer's reference. For cHttpClient, set ClientCertificate to 0 before freeing the handle.

Example

Handle hCertificate hoHttp

Get DFSEC_CertificateFromFile C_DFSEC_CERTFORMAT_PEM "client.pem" "client-key.pem" "" to hCertificate
If (hCertificate <> 0) Begin
    Object oHttp is a cHttpClient
        Move Self to hoHttp
    End_Object

    Set ClientCertificate of hoHttp to hCertificate
    // Use hoHttp here.
    Set ClientCertificate of hoHttp to 0

    Send DFSEC_CertificateFree hCertificate
End