INET::SSLContext Class
Description
Methods for working with SSL certificates and encrypted data.
Discussion
When using SSL, you need to provide a server-side certificate, a private key, and often a password as part of the context. The INET::SSLSocket method automatically creates the context object, which can be accessed by referencing the Context property. Alternatively, you can create a context object and assign it to each new INET::SSLSocket. Since initializing the context is fairly expensive to establish, you can get better performance by sharing the context among sockets.
Example
This example does not use the INET::SSLContext object.
dim Socket as INET::SSLSocket Socket.Context.CertificateFile = CertificatePath + "secure.alphafiveonline.com.crt" Socket.Context.PrivateKeyFile = CertificatePath + "secure.alphafiveonline.com.key" Socket.Context.password = ""
This example uses the INET::SSLContext object.
dim Context as SQLContext dim Socket as INET::SSLSocket Context.CertificateFile = CertificatePath + "secure.alphafiveonline.com.crt" Context.PrivateKeyFile = CertificatePath + "secure.alphafiveonline.com.key" Context.password = "" if .not. Context.EstablishContext() ' Check Context.callresult and write code to handle error end if Socket.Context = Context
Properties
- PrivateKeyFileCharacter
The path and name of the private key file.
- CertificateFileCharacter
The path and name of the SSL Server Certificate file.
- CertificateAuthorityFileCharacter
The path and name of the SSL Certificate Authority file.
- CertificateChainFileCharacter
The path and name of the SSL Certificate Chain file.
- PasswordCharacter
String Password property
- CallResultCallResult
Information about success or failure.
- CipherListCharacter
String CipherList property
- RequireValidCertificateLogical
RequireValidCertificate property
- ServerNameCharacter
ServerName is used to force a value for Server Name Indication (SNI) when that value is different than the host name passed to the INET::SSLSocket.Connect() function. This property is not typically used and is optional. For example, you may want to connect to a specific server that is behind a load balancer and the server instance terminates TLS (SSL). In that case, you would set the ServerName property of the INET::SSLContext object to match the server name expected on the certificate and then pass the IP address of the server to INET::SSLSocket.Connect() as the host.
Methods
- CreateCertificateRequest Method
Create a request for a certificate.
- CreatePrivateKey Method
Create a private key with an optional password and write to KeyFileName. Bits must be one of 512, 1024, 2048, or 4096
- CreateTestCertificate Method
Create a server test certificate using an existing private key.
- DecryptString Method
Decrypts a string which has been encrypted and converted to base64 encoding.
- EncryptString Method
Encrypts the string provided and encodes the encryption result using base64 encoding.
- EstablishContext Method
Create and verify SSL parameters and settings. This function is optional. Use it if you want to verify a context.
See Also