Xbasic

INET::SSLContext::CreateTestCertificate Method

Syntax

Result_Flag as L = CreateTestCertificate(CertificateFile as C, PrivateKeyFile as C, PrivateKeyPassword as C [, DaysCertificateIsValid = 365 as N [, CountryCode = "US" as C [, State = "MA" as C [, Locality = "Burlington" as C [, Organization = "Alpha Software Customer" as C [, OrganizationalUnit = "Development Test" as C [, CommonName = "www.mydomain.com" as C [, Comment = "Self Signed Server Test Certificate" as C [, ServerName = "localhost" as C [, SerialNumber = 0 as N ]]]]]]]]]])

Arguments

Result_Flag

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

CertificateFile

The path and name of the SSL Server Certificate.

PrivateKeyFile

The path and name of the private key file.

PrivateKeyPassword

The password for the private key file.

DaysCertificateIsValid = 365

Optional. Default = 365.

CountryCode = "US"

Optional. Default = "US".

State = "MA"

Optional. Default = "MA".

Locality = "Burlington"

Optional. Default = "Burlington".

Organization = "Alpha Software Customer"

Optional. Default = "Alpha Software Customer".

OrganizationalUnit = "Development Test"

Optional. Default = "Development Test".

CommonName = "www.mydomain.com"

Optional. Default = "Server Test Certificate".

Comment = "Self Signed Server Test Certificate"

Optional. Default = "Self Signed Server Test Certificate".

ServerName = "localhost"

Optional. Default = "localhost".

SerialNumber = 0

Optional. Default = 0.

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