Xbasic

INET::SSLContextCreateTestCertificate Method

Syntax

Result_Flag as L = CreateTestCertificate(CertificateFile as C, PrivateKeyFile as C, PrivateKeyPassword as C [, DaysCertificateIsValid as N [, CountryCode as C [, State as C [, Locality as C [, Organization as C [, OrganizationalUnit as C [, CommonName as C [, Comment as C [, ServerName as C [, SerialNumber as N ]]]]]]]]]])

Arguments

CertificateFileCharacter

The path and name of the SSL Server Certificate.

PrivateKeyFileCharacter

The path and name of the private key file.

PrivateKeyPasswordCharacter

The password for the private key file.

DaysCertificateIsValidNumeric

Default = 365.

CountryCodeCharacter

Default = "US".

StatCharacter

Default = "MA".

LocalityCharacter

Default = "Burlington".

OrganizationCharacter

Default = "Alpha Software Customer".

OrganizationalUnitCharacter

Default = "Development Test".

CommonNameCharacter

Default = "www.mydomain.com". You can provide multiple names as a CRLF delimited string.

CommentCharacter

Default = "Self Signed Server Test Certificate".

ServerNameCharacter

Default = "localhost".

SerialNumberNumeric

Default = 0.

Returns

Result_FlagLogical

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

Description

Create a server test certificate using an existing private key.

Discussion

The INET::SSLContext::CreateTestCertificate() method creates a server test certificate using an existing private key.

Example

dim ctx as INET::SSLContext
if ctx.CreateTestCertificate(CertFile, KeyFile, Password, 1024, "US", "MA", "Burlington", "Alpha Software, Inc.", "Dev", "localhost", "Homemade", "localhost", 12345)
    Result = "Certificate successfully created"
else
    Result = "Error creating certificate: " + ctx.callresult.text
end if

ui_msg_box("Create certificate: " + CertFile, Result)

See Also