Skip to content

SelectClientCertificate - cBaseHTTPTransfer

Selects a client certificate to be used in an Http request

Type: Function
Return Data Type: Boolean

Parameters

Parameter Type Description
sCertificateStore string String naming a system store
sCertificateSubject String Certificate Subject

Syntax

Function SelectClientCertificate string sCertificateStore String sCertificateSubject Returns Boolean

Call Example

Get SelectClientCertificate sCertificateStore sCertificateSubject to BooleanVariable

Description

If a secure SSL site, requires client certification, your Http object must be able to select a client certificate. The SelectClientCertificate allows you to do this.

The SelectClientCertificate function finds the first or next certificate context in a certificate store containing the specified subject name string. It returns True if successful. If function fails you can examine error code with LastErrorCode property.

The first parameter, sCertStore, is a string naming a system store. Some possible values are:

Value Meaning
MY A certificate store that holds certificates with associated private keys (Try this first).
CA Certification authority certificates.
ROOT Root certificates.
SPC Software Publisher Certificate.

Most times you will want to use "MY".

The specified store is searched for a certificate containing the subject name sCertSubject. A case-insensitive substring-within-a-string match is performed. The first one that matches the criteria will be selected.

Example

Suppose there is a certificate in "Personal" store whose subject contains word "Test". You will select that certificate with following code:

Boolean bSelected
Integer   iErrCode

Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure
Get SelectClientCertificate "MY" "Test" to bSelected
If not bSelected begin
    Get LastErrorCode to iErrCode
    :
End

A user can manually select a client certificate by setting the pbShowErrorDialog property to True.

See Also

LastErrorCode | pbShowErrorDialog

Return Value

returns True if certificate was properly selected, False if certificate was not found