Beispiel #1
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Sharpen.GeneralSecurityException"/>
        private static ConnectionConfigurator NewSslConnConfigurator(int timeout, Configuration
                                                                     conf)
        {
            SSLFactory       factory;
            SSLSocketFactory sf;
            HostnameVerifier hv;

            factory = new SSLFactory(SSLFactory.Mode.Client, conf);
            factory.Init();
            sf = factory.CreateSSLSocketFactory();
            hv = factory.GetHostnameVerifier();
            return(new _ConnectionConfigurator_536(sf, hv, timeout));
        }
Beispiel #2
0
 /// <exception cref="System.IO.IOException"/>
 private HttpURLConnection ConfigureConnection(HttpURLConnection conn)
 {
     if (sslFactory != null)
     {
         HttpsURLConnection httpsConn = (HttpsURLConnection)conn;
         try
         {
             httpsConn.SetSSLSocketFactory(sslFactory.CreateSSLSocketFactory());
         }
         catch (GeneralSecurityException ex)
         {
             throw new IOException(ex);
         }
         httpsConn.SetHostnameVerifier(sslFactory.GetHostnameVerifier());
     }
     return(conn);
 }
Beispiel #3
0
 protected internal virtual void OpenConnection(Uri url)
 {
     lock (this)
     {
         HttpURLConnection conn = (HttpURLConnection)url.OpenConnection();
         if (sslShuffle)
         {
             HttpsURLConnection httpsConn = (HttpsURLConnection)conn;
             try
             {
                 httpsConn.SetSSLSocketFactory(sslFactory.CreateSSLSocketFactory());
             }
             catch (GeneralSecurityException ex)
             {
                 throw new IOException(ex);
             }
             httpsConn.SetHostnameVerifier(sslFactory.GetHostnameVerifier());
         }
         connection = conn;
     }
 }