diff -c -d -r pgjdbc.orig/doc/pgjdbc.xml pgjdbc/doc/pgjdbc.xml
*** pgjdbc.orig/doc/pgjdbc.xml	2007-07-24 16:22:01.000000000 +0200
--- pgjdbc/doc/pgjdbc.xml	2007-07-25 13:23:04.000000000 +0200
***************
*** 2671,2676 ****
--- 2671,2694 ----
        </row>
   
        <row>
+        <entry><literal>ssl</literal></entry>
+        <entry><type>boolean</type></entry>
+        <entry>
+         If <literal>true</literal>, use SSL encrypted connections
+         (default <literal>false</literal>)
+        </entry>
+       </row>
+  
+       <row>
+        <entry><literal>sslfactory</literal></entry>
+        <entry><type>String</type></entry>
+        <entry>
+         Custom <classname>javax.net.ssl.SSLSocketFactory</classname>
+         class name (see <xref linkend="ssl-factory"/>)
+        </entry>
+       </row>
+  
+       <row>
         <entry><literal>defaultAutoCommit</literal></entry>
         <entry><type>boolean</type></entry>
         <entry>
***************
*** 2810,2815 ****
--- 2828,2851 ----
         <entry><type>String</type></entry>
         <entry>Password used to make database connections</entry>
        </row>
+  
+       <row>
+        <entry><literal>ssl</literal></entry>
+        <entry><type>boolean</type></entry>
+        <entry>
+         If <literal>true</literal>, use SSL encrypted connections
+         (default <literal>false</literal>)
+        </entry>
+       </row>
+  
+       <row>
+        <entry><literal>sslfactory</literal></entry>
+        <entry><type>String</type></entry>
+        <entry>
+         Custom <classname>javax.net.ssl.SSLSocketFactory</classname>
+         class name (see <xref linkend="ssl-factory"/>)
+        </entry>
+       </row>
       </tbody>
      </tgroup>
      </table>
diff -c -d -r pgjdbc.orig/org/postgresql/ds/common/BaseDataSource.java pgjdbc/org/postgresql/ds/common/BaseDataSource.java
*** pgjdbc.orig/org/postgresql/ds/common/BaseDataSource.java	2007-07-24 16:22:01.000000000 +0200
--- pgjdbc/org/postgresql/ds/common/BaseDataSource.java	2007-07-25 09:57:50.000000000 +0200
***************
*** 49,54 ****
--- 49,56 ----
      private int portNumber;
      private int prepareThreshold;
      private int loginTimeout; // in seconds
+     private boolean ssl = false;
+     private String sslfactory;
  
      /**
       * Gets a connection to the PostgreSQL database.  The database is identified by the
***************
*** 261,273 ****
      }
  
      /**
       * Generates a DriverManager URL from the other properties supplied.
       */
      private String getUrl()
      {
          return
              "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" : ":" + portNumber) + "/" + databaseName +
!             "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold;
      }
  
      /**
--- 263,320 ----
      }
  
      /**
+      * Set whether the connection will be SSL encrypted or not.
+      *
+      * @param enabled if <CODE>true</CODE>, connect with SSL.
+      */
+     public void setSsl(boolean enabled)
+     {
+         this.ssl = enabled;
+     }
+ 
+     /**
+      * Gets SSL encryption setting.
+      *
+      * @return <CODE>true</CODE> if connections will be encrypted with SSL.
+      */
+     public boolean getSsl()
+     {
+         return this.ssl;
+     }
+ 
+     /**
+      * Set the name of the {@link javax.net.ssl.SSLSocketFactory} to use for connections.
+      * Use <CODE>org.postgresql.ssl.NonValidatingFactory</CODE> if you don't want certificate validation.
+      *
+      * @param classname name of a subclass of <CODE>javax.net.ssl.SSLSocketFactory</CODE> or <CODE>null</CODE> for the default implementation.
+      */
+     public void setSslfactory(String classname)
+     {
+         this.sslfactory = classname;
+     }
+ 
+     /**
+      * Gets the name of the {@link javax.net.ssl.SSLSocketFactory} used for connections.
+      *
+      * @return name of the class or <CODE>null</CODE> if the default implementation is used.
+      */
+     public String getSslfactory()
+     {
+         return this.sslfactory;
+     }
+ 
+     /**
       * Generates a DriverManager URL from the other properties supplied.
       */
      private String getUrl()
      {
          return
              "jdbc:postgresql://" + serverName + (portNumber == 0 ? "" : ":" + portNumber) + "/" + databaseName +
!             "?loginTimeout=" + loginTimeout + "&prepareThreshold=" + prepareThreshold +
!             (this.ssl
!                 ? "&ssl" + ((null != this.sslfactory) ? "&sslfactory=" + this.sslfactory : "")
!                 : ""
!             );
      }
  
      /**
