SSL secures the integrity of your data by encrypting information and providing authentication. See “Data Encryption Across the Network” for an overview.Depending on your Microsoft SQL Server configuration, you can choose to encrypt all data, including the login request, or encrypt the login request only. Encrypting login requests, but not data, is useful for the following scenarios:
■ When your application needs security, but cannot afford to pay the performance penalty for encrypting data transferred between the driver and server.
■ Microsoft SQL Server 2005 and higher only. When the server is not configured for SSL, but your application still requires a minimum degree of security.NOTE: When SSL is enabled, the driver communicates with database protocol packets set by the server’s default packet size. Any value set by the PacketSize property is ignored.If your Microsoft SQL Server database server has been configured with an SSL certificate signed by a trusted CA, the server can be configured so that SSL encryption is either optional or required. When required, connections from clients that do support SSL encryption fail.Although a signed trusted SSL certificate is recommended for the best degree of security, Microsoft SQL Server 2005 and higher can provide limited security protection even if an SSL certificate has not been configured on the server. If a trusted certificate is not installed, the server will use a self-signed certificate to encrypt the login request, but not the data.Table 9-4 shows how the different EncryptionMethod property values behave with different Microsoft SQL Server configurations.
Login request and data are not encrypted. Login request and data are not encrypted. Login request and data are encrypted. Login request and data are encrypted. Login request and data are not encrypted. Login request and data are encrypted. Login request and data are encrypted. Microsoft SQL Server 2005 and higher: Login request is encrypted, but data is not encryptedMicrosoft SQL Server 2000: Connection attempt fails. Login request is encrypted, but data is not encrypted. Login request and data are encrypted.
■ If you want the driver to encrypt all data, including the login request, set the EncryptionMethod property to SSL or requestSSL.
■ If you want the driver to encrypt only the login request, set the EncryptionMethod property to loginSSL.
2 Specify the location and password of the truststore file used for SSL server authentication. Either set the TrustStore and TrustStore properties or their corresponding Java system properties (javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword, respectively).
3
4 Optionally, set the HostNameInCertificate property to a host name to be used to validate the certificate. The HostNameInCertificate property provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.