Method HttpEndpoint():setCertificate() Professional

Binds a server certificate from the Windows Certificate Store for SSL connections.

Syntax
:setCertificate( [<cCertificate>] ) --> lSuccess
:setCertificate( [<cSubject>] [, <cStoreName>] [, <cLocation>] ) --> lSuccess
Parameters
<cCertificate>
A character string specifying the location of the SSL certificate in a certificate store. The string must be in the following format: machine|user\<storename>\<subject>. Note that the string is case-senstive. The <cCertificate> parameter is optional. If it is omitted, the location "machine\my\<computer name>" is used.
<cSubject>
A character string with the name of the entity associated with the SSL certificate. The subject name is case-sensitive. It defaults to the computer name.
<cStoreName>
A character string specifying the name of the certificate store. If no store name is specified, "my" is used which corresponds to the default store.
<cLocation>
A character string which selects the location of the certificate store. This can be either "user" or "machine". If no location is passed, the machine context is used as the default.
Return

The logical value true (.T.), if the specified server certificate is set for SSL connections. Otherwise, the value false (.F.) is returned.

Description

The method :setCertificate() sets a SSL certificate to be used for subsequent Secure Socket Layer (SSL) connections. Once a certificate is set via :setCertificate(), clients can connect via SSL to this HTTP end point. The SSL certificate can be changed again at a later time via another call to :setCertificate(), without having to stop the HTTP end point.

The SSL certificate must be specified via the subject name, the name of the certificate store, and the location the store resides in. A certificate store can exist either in the user or in the machine context. The user context contains certificates for the current user, whereas certificates in the machine context are valid for the local machine.

:setCertificate() can be called with a location string in the <cCertificate> parameter. Alternatively, the location can be specified as individual path components via the <cSubject>, <cStoreName> and <cLocation> parameters. If no certificate is specified to :setCertificate() the method attempts to set a certificate for the local machine.

The function IsCertificateAvailable() can be used to check whether a certificate is available on the computer.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.