dotConnect for PostgreSQL Documentation
Devart.Data.PostgreSql Namespace / SslOptions Class
Members Example

SslOptions Class
Represents information required to establish a SSL connection.
Syntax
'Declaration
 
Public NotInheritable Class SslOptions 
 
Remarks

This class is used in conjunction with PgSqlConnection to establish secure connection.

The following files are required for SSL encryption:

  • Authority certificate (for example root.crt) - used to verify identity of client and server.
  • Client certificate (for example client.crt) - used to encrypt and decrypt data during connection.
  • Private key (for example client.crt) - proves client certificate sent by owner; does not indicate certificate owner is trustworthy.

For more information on client side configuration you can visit OpenSSL site at http://openssl.org/. For information on SSL support in PostgreSQL server, refer to the PostgreSQL documentation topic Secure TCP/IP Connections with SSL.

Example
The following example shows how to enable SSL data transfer with dotConnect for PostgreSQL.
PgSqlConnection conn = new PgSqlConnection("user id=postgres;password=postgres;host=localhost;");
conn.SslOptions.CACert = "E:\\Test\\root.crt";
conn.SslOptions.Cert = "E:\\Test\\client.crt";
conn.SslOptions.Key = "E:\\Test\\client.key";
conn.SslOptions.SslMode = SslMode.Require;
conn.Open();
Dim conn As PgSqlConnection = New PgSqlConnection("user id=postgres;password=postgres;host=localhost;")
conn.SslOptions.CACert = "E:\Test\root.crt"
conn.SslOptions.Cert = "E:\Test\client.crt"
conn.SslOptions.Key = "E:\Test\client.key"
conn.SslOptions.SslMode = SslMode.Require
conn.Open()
Inheritance Hierarchy

System.Object
   Devart.Data.PostgreSql.SslOptions

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also