Sets the use of ssl.

    Args:
      use_ssl (bool): enforces use of ssl.
334822
def SetUseSSL(self, use_ssl):
    
    self._use_ssl = use_ssl
    logger.debug('Elasticsearch use_ssl: {0!s}'.format(use_ssl))
203205
def configure(cert)
      cert.version = 2
      cert.serial = serial
      cert.subject = OpenSSL::X509::Name.parse(name)
      cert.issuer = cert.subject
      cert.public_key = key.public_key
      cert.not_before = days_ago(2)
      cert.not_after = days_from_now(2)
    end
459600
def connect_ssl(cls, user, password, endpoints,
                    ca_certs=None, validate=None):
        
        if isinstance(endpoints, basestring):
            endpoints = [endpoints]
        transport = SingleEndpointTransport(
            SocketTransport.connect_ssl, endpoints, ca_certs=ca_certs,
            validate=validate)
        return cls(transport, user, password)
395788
public function setUseSSL(string $use_ssl = "F") : CNabuDataObject
    {
        if ($use_ssl === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$use_ssl")
            );
        }
        $this->setValue('nb_cluster_group_service_use_ssl', $use_ssl);
        
        return $this;
    }
58718
def setUrl(self, url):
        
        if isUrl(url):
            self._url = url
        else:
            raise exceptions.BadUrlException(url)
        return self
715234
def enable_ssl(self, *args, **kwargs):
        
        if self.handshake_sent:
            raise SSLError('can only enable SSL before handshake')

        self.secure = True
        self.sock = ssl.wrap_socket(self.sock, *args, **kwargs)
594654
def ssl_proxy(self, value):
        
        self._verify_proxy_type_compatibility(ProxyType.MANUAL)
        self.proxyType = ProxyType.MANUAL
        self.sslProxy = value
1197730
def initialize_net_http_ssl(uri)
      http = Net::HTTP.new(uri.host, uri.port)

      http.use_ssl = uri.scheme == 'https'

      if defined?(Rails) && Rails.env.test?
        in_rails_test_env = true
      else
        in_rails_test_env = false
      end

      if http.use_ssl? && !in_rails_test_env
        if ca_file
          if File.exists?(ca_file)
            http.ca_file = ca_file
          else
            raise 'Certificate path not found.'
          end
        end

        # Explicitly verifies that the certificate matches the domain.
        # Requires that we use www when calling the production DocuSign API
        http.verify_mode = OpenSSL::SSL::VERIFY_PEER
        http.verify_depth = 5
      else
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
      end

      http.open_timeout = open_timeout
      http.read_timeout = read_timeout

      http
    end
322849
def _add_ssl_info(self):
        """"""
        if self.scheme == u'https':
            sock = self._get_ssl_sock()
            if hasattr(sock, 'cipher'):
                self.ssl_cert = sock.getpeercert()
            else:
                # using pyopenssl
                cert = sock.connection.get_peer_certificate()
                self.ssl_cert = httputil.x509_to_dict(cert)
            log.debug(LOG_CHECK, "Got SSL certificate %s", self.ssl_cert)
        else:
            self.ssl_cert = None
193757
def _init_base_objects(self, ssl_version: OpenSslVersionEnum, underlying_socket: Optional[socket.socket]) -> None:
        
        self._is_handshake_completed = False
        self._ssl_version = ssl_version
        self._ssl_ctx = self._NASSL_MODULE.SSL_CTX(ssl_version.value)

        # A Python socket handles transmission of the data
        self._sock = underlying_socket
326611
protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl,
			SslStoreProvider sslStoreProvider) {
		protocol.setSSLEnabled(true);
		protocol.setSslProtocol(ssl.getProtocol());
		configureSslClientAuth(protocol, ssl);
		protocol.setKeystorePass(ssl.getKeyStorePassword());
		protocol.setKeyPass(ssl.getKeyPassword());
		protocol.setKeyAlias(ssl.getKeyAlias());
		String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers());
		if (StringUtils.hasText(ciphers)) {
			protocol.setCiphers(ciphers);
		}
		if (ssl.getEnabledProtocols() != null) {
			for (SSLHostConfig sslHostConfig : protocol.findSslHostConfigs()) {
				sslHostConfig.setProtocols(StringUtils
						.arrayToCommaDelimitedString(ssl.getEnabledProtocols()));
			}
		}
		if (sslStoreProvider != null) {
			configureSslStoreProvider(protocol, sslStoreProvider);
		}
		else {
			configureSslKeyStore(protocol, ssl);
			configureSslTrustStore(protocol, ssl);
		}
	}
614658
def setup_communication_daemon(self):
        # pylint: disable=no-member
        
        ca_cert = ssl_cert = ssl_key = server_dh = None

        # The SSL part
        if self.use_ssl:
            ssl_cert = os.path.abspath(self.server_cert)
            if not os.path.exists(ssl_cert):
                self.exit_on_error("The configured SSL server certificate file '%s' "
                                   "does not exist." % ssl_cert, exit_code=2)
            logger.info("Using SSL server certificate: %s", ssl_cert)

            ssl_key = os.path.abspath(self.server_key)
            if not os.path.exists(ssl_key):
                self.exit_on_error("The configured SSL server key file '%s' "
                                   "does not exist." % ssl_key, exit_code=2)
            logger.info("Using SSL server key: %s", ssl_key)

            if self.server_dh:
                server_dh = os.path.abspath(self.server_dh)
                logger.info("Using ssl dh cert file: %s", server_dh)
                self.exit_on_error("Sorry, but using a DH configuration "
                                   "is not currently supported!", exit_code=2)

            if self.ca_cert:
                ca_cert = os.path.abspath(self.ca_cert)
                logger.info("Using ssl ca cert file: %s", ca_cert)

            if self.hard_ssl_name_check:
                logger.info("Enabling hard SSL server name verification")

        # Let's create the HTTPDaemon, it will be started later
        # pylint: disable=E1101
        try:
            logger.info('Setting up HTTP daemon (%s:%d), %d threads',
                        self.host, self.port, self.thread_pool_size)
            self.http_daemon = HTTPDaemon(self.host, self.port, self.http_interface,
                                          self.use_ssl, ca_cert, ssl_key,
                                          ssl_cert, server_dh, self.thread_pool_size,
                                          self.log_cherrypy, self.favicon)
        except PortNotFree:
            logger.error('The HTTP daemon port (%s:%d) is not free...', self.host, self.port)
            return False

        except Exception as exp:  # pylint: disable=broad-except
            print('Setting up HTTP daemon, exception: %s', str(exp))
            logger.exception('Setting up HTTP daemon, exception: %s', str(exp))
            return False

        return True
752550
def sslErrors(self, ssl_errors):
        
        if ssl_errors:
            for v in ssl_errors:
                self.msg_log("SSL Error: %s" % v.errorString())
        if self.disable_ssl_certificate_validation:
            self.reply.ignoreSslErrors()
871804
def set_proxy(proxy_url, transport_proxy=None):
    """"""
    global proxy, PYPI_URL
    PYPI_URL = proxy_url
    proxy = xmlrpc.ServerProxy(
        proxy_url,
        transport=RequestsTransport(proxy_url.startswith('https://')),
        allow_none=True)
652581
def set_context(ctx)
    # Verification: Use Store#verify_callback instead of SSLContext#verify*?
    ctx.cert_store = @cert_store
    ctx.verify_mode = @verify_mode
    ctx.verify_depth = @verify_depth if @verify_depth
    ctx.verify_callback = @verify_callback || method(:default_verify_callback)
    # SSL config
    ctx.cert = @client_cert
    ctx.key = @client_key
    ctx.client_ca = @client_ca
    ctx.timeout = @timeout
    ctx.options = @options
    ctx.ciphers = @ciphers
  end
1372921
def _init_security(self):
        
        if not self._starttls():
            raise SecurityError("Could not start TLS connection")
        # _ssh_handshake() will throw an exception upon failure
        self._ssl_handshake()
        if not self._auth():
            raise SecurityError("Could not authorize connection")
565110
def start(self):
        
        self.log.info("Starting SSL Session for Monitor %s."
                      % self.monitor_id)
        if self.socket is not None:
            raise Exception("Socket already established for %s." % self)

        try:
            # Create socket, wrap in SSL and connect.
            self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            # Validate that certificate server uses matches what we expect.
            if self.ca_certs is not None:
                self.socket = ssl.wrap_socket(self.socket,
                                              cert_reqs=ssl.CERT_REQUIRED,
                                              ca_certs=self.ca_certs)
            else:
                self.socket = ssl.wrap_socket(self.socket)

            self.socket.connect((self.client.hostname, PUSH_SECURE_PORT))
            self.socket.setblocking(0)
        except Exception as exception:
            self.socket.close()
            self.socket = None
            raise exception

        self.send_connection_request()