Initialize the ssl
775706
@Override
  public void ssl(SSLFactory sslFactory)
  {
    try {
      Objects.requireNonNull(sslFactory);
    
      SocketChannel channel = _channel;
      Objects.requireNonNull(channel);
    
      _sslSocket = sslFactory.ssl(channel);
      _sslSocket.startHandshake();
    } catch (IOException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
1124014
def _initialize(self):
        ''''''
        credentials = (self.username if self.username else '') + ':' + (self.password if self.password else '')
        credentials = credentials.encode(self._encoding)
        self._connection.send(credentials + b'\3\0')
        response = self._connection.recv(1)

        if len(response) != 1:
            self.close()
            self._init_socket()

            self._connection.send(credentials + b'\0')
            response = self._connection.recv(1)
            if len(response) != 1:
                self.close()
                raise QAuthenticationException('Connection denied.')

        self._protocol_version = min(struct.unpack('B', response)[0], 3)
531363
protected function initialize()
    {
        $this->url = '';
        $this->options = [];
        $this->secure = array_get($this->config, 'secure', true);
        $this->retryOn = array_get($this->config, 'retry.on', [500, 502, 503, 504]);
        $this->retryDelay = array_get($this->config, 'retry.delay', 10);
        $this->retry = array_get($this->config, 'retry.times', 5);
        $this->verify = array_get($this->config, 'verify', true);
        $this->async = array_get($this->config, 'async', false);
    }
535246
def post_init(*args)
      logger.info "got connection from #{remote_ip}"

      # initialize the line-based protocol: IRC is \r\n
      @lt2_delimiter = "\r\n"

      # start up the IRCD for this connection
      @ircd = IRCD.new(self, options)

      if options[:ssl]
        logger.info "starting TLS for #{remote_ip}"
        start_tls(:cert_chain_file => options[:ssl_cert], :private_key_file => options[:ssl_private_key], :verify_peer => options[:ssl_verify_peer])
      end
    end
1120920
protected function initSsl()
    {
        if ('system' == ($authority = $this->config[self::SSL_CERT_AUTHORITY])) {
            return;
        }

        if ($authority === null) {
            $authority = true;
        }

        if ($authority === true && substr(__FILE__, 0, 7) == 'phar://') {
            $authority = $this->preparePharCacert();
            $that = $this;
            $this->getEventDispatcher()->addListener('request.before_send', function ($event) use ($authority, $that) {
                if ($authority == $event['request']->getCurlOptions()->get(CURLOPT_CAINFO)) {
                    $that->preparePharCacert(false);
                }
            });
        }

        $this->setSslVerification($authority);
    }
931041
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_port=self._proxy_port,
                                 proxy_url=self._proxy_url)
        self._json = json.dumps(json_dict)
        self._json_dict = json_dict
        self.loadAttributes(json_dict=json_dict)
1102261
def create_ssl_context():
        """"""
        ssl_context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
        ssl_context.check_hostname = False
        ssl_context.verify_mode = ssl.CERT_NONE
        return ssl_context
712181
public static function init()
    {
        self::add(self::HEADER_SET_COOKIE, '__Host-sess=' . session_id() . '; path=' . Request::$subfolders . '; Secure; HttpOnly; SameSite;');
        if (Request::isSecure()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
            self::add(self::HEADER_STRICT_TRANSPORT_SECURITY, self::HEADER_STRICT_TRANSPORT_SECURITY_CONTENT);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
        } elseif (Request::isLocalhost()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
        } else {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
        }
        self::$initialized = true;
    }
1315884
private function initSoapClient() {
        if ($this->soapClient === NULL) {
            $this->soapClient = new SoapClient($this->service, $this->key, $this->cert, $this->trace, $this->passphrase);
        }
    }
1178815
def __init(self):
        
        params = {
            "f" : "json"
        }
        json_dict = self._get(url=self._url, param_dict=params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]
        for k,v in json_dict.items():
            if k in attributes:
                setattr(self, "_"+ k, json_dict[k])
            else:
                print( k, " - attribute not implemented in RouteNetworkLayer.")
            del k,v
912575
private function init()
    {
        $this->module = mcrypt_module_open($this->algorithm, '', MCRYPT_MODE_ECB, '');

        // Create the IV and determine the keysize length
        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->module), MCRYPT_RAND);
        $ks = mcrypt_enc_get_key_size($this->module);

        /* Create key */
        $key = substr(md5($this->secretKey), 0, $ks);

        /* Intialize */
        mcrypt_generic_init($this->module, $key, $iv);
    }
1342451
def _initialize(cls, port, secret):
        
        cls._port = port
        cls._secret = secret
375000
def __init(self):
        
        params = {
            "f" : "json",
        }

        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_port=self._proxy_port,
                                 proxy_url=self._proxy_url)
        self._json_dict = json_dict
        self._dict = json_dict
        self._json = json.dumps(self._dict)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]
        for k,v in json_dict.items():
            if k == "layers":
                self._layers = []
                for lyr in v:
                    fl = AdminFeatureServiceLayer(url=self._url + "/%s" % lyr['id'],
                                                  securityHandler=self._securityHandler,
                                                  proxy_port=self._proxy_port,
                                                  proxy_url=self._proxy_url)
                    fl.loadAttributes(json_dict = lyr)
                    self._layers.append(fl)
                    del fl
                    del lyr
            elif k == "tables":
                self._tables = []
                for lyr in v:
                    fl = AdminFeatureServiceLayer(url=self._url + "/%s" % lyr['id'],
                                                  securityHandler=self._securityHandler,
                                                  proxy_port=self._proxy_port,
                                                  proxy_url=self._proxy_url)
                    fl.loadAttributes(json_dict = lyr)
                    self._tables.append(fl)
                    del fl
                    del lyr
            elif k in attributes:
                setattr(self, "_"+ k, json_dict[k])
            else:
                print( k, " - attribute not implemented in AdminFeatureService.")
245845
public void init() throws SSLException {
        if (sslEngine != null) {
            // We already have a SSL engine created, no need to create a new one
            return;
        }

        InetSocketAddress peer = (InetSocketAddress) session
                .getAttribute(SslFilter.PEER_ADDRESS);
        
        // Create the SSL engine here
        if (peer == null) {
            sslEngine = sslContext.createSSLEngine();
        } else {
            sslEngine = sslContext.createSSLEngine(peer.getHostName(), peer.getPort());
        }

        // Initialize the engine in client mode if necessary
        sslEngine.setUseClientMode(parent.isUseClientMode());

        // Initialize the different SslEngine modes
        if (parent.isWantClientAuth()) {
            sslEngine.setWantClientAuth(true);
        }

        if (parent.isNeedClientAuth()) {
            sslEngine.setNeedClientAuth(true);
        }

        if (logger.isTraceEnabled()) {
            List<String> supportedCiphers = toCipherList(sslEngine.getSupportedCipherSuites());
            if (supportedCiphers != null) {
                logger.trace(String.format("Supported SSL/TLS ciphersuites:\n  %s", toCipherString(supportedCiphers)));

            } else {
                logger.trace("Supported SSL/TLS ciphersuites: none");
            }

            List<String> enabledCiphers = toCipherList(sslEngine.getEnabledCipherSuites());
            if (enabledCiphers != null) {
                logger.trace(String.format("Default enabled SSL/TLS ciphersuites:\n  %s", toCipherString(enabledCiphers)));

            } else {
                logger.trace("Enabled SSL/TLS ciphersuites: none");
            }

            if (sslEngine.getWantClientAuth() ||
                sslEngine.getNeedClientAuth()) {
                logger.trace(String.format("Client certificate verification %s", sslEngine.getNeedClientAuth() ? "REQUIRED" : "requested" ));
            }
        }

        // NOTE: We need to modify the MINA code here so that we can properly
        // handle the intersecting of configured and supported ciphersuites;
        // we can only do this AFTER the SSLEngine has been instantiated,
        // since different providers will support different ciphersuites.
 
        String[] enabledCipherSuites = parent.getEnabledCipherSuites();
        if (enabledCipherSuites != null) {
            // The list of enabled ciphers which can be set is the intersection
            // of the supported ciphers list and the list of ciphers to be
            // enabled.
            List<String> supportedCiphers = toCipherList(sslEngine.getSupportedCipherSuites());
            List<String> configuredCiphers = toCipherList(enabledCipherSuites);
            configuredCiphers.retainAll(supportedCiphers);

            if (logger.isTraceEnabled()) {
                logger.trace(String.format("SSL/TLS ciphersuites in use:\n  %s", toCipherString(configuredCiphers)));
            }

            String[] enabledCiphers = configuredCiphers.toArray(new String[configuredCiphers.size()]);
            sslEngine.setEnabledCipherSuites(enabledCiphers);
        }

        String[] protocols = parent.getEnabledProtocols();
        if (protocols == null || protocols.length == 0) {
            // Service didn't configure any protocols. Let us not include SSLv2, SSLv3 protocols
            // by default as there are known vulnerabilities
            protocols = removeSslProtocols(sslEngine.getSupportedProtocols());
        } else {
            boolean sslv3Enabled = isSslv3Enabled(protocols);
            if (sslv3Enabled && logger.isWarnEnabled()) {
                logger.warn("SSLv3 protocol is enabled. SSLv3 known to have vulnerabilities");
            }
        }
        if (logger.isTraceEnabled()) {
            logger.trace(String.format("SSL/TLS enabled protocols are: %s", Arrays.asList(protocols)));
        }
        sslEngine.setEnabledProtocols(protocols);

        // TODO : we may not need to call this method...
        sslEngine.beginHandshake();
        
        handshakeStatus = sslEngine.getHandshakeStatus();

        handshakeComplete = false;
        initialHandshakeComplete = false;
        writingEncryptedData = false;
    }
502239
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        self._json_dict = json_dict
        self._json = json.dumps(self._json_dict)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]

        for k,v in json_dict.items():
            if k in attributes:
                if k == "routeLayers" and json_dict[k]:
                    self._routeLayers = []
                    for rl in v:
                        self._routeLayers.append(
                            RouteNetworkLayer(url=self._url + "/%s" % rl,
                                              securityHandler=self._securityHandler,
                                              proxy_url=self._proxy_url,
                                              proxy_port=self._proxy_port,
                                              initialize=False))

                elif k == "serviceAreaLayers" and json_dict[k]:
                    self._serviceAreaLayers = []
                    for sal in v:
                        self._serviceAreaLayers.append(
                            ServiceAreaNetworkLayer(url=self._url + "/%s" % sal,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))

                elif k == "closestFacilityLayers" and json_dict[k]:
                    self._closestFacilityLayers = []
                    for cf in v:
                        self._closestFacilityLayers.append(
                            ClosestFacilityNetworkLayer(url=self._url + "/%s" % cf,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))
                else:
                    setattr(self, "_"+ k, v)
            else:
                print ("attribute %s is not implemented." % k)
607514
public function initOpenSSL()
    {
        if (!$this->initOpenSSL) {
            if (is_file($this->privateKey)) {
                $privateKey = "file://" . $this->privateKey;
            } else {
                $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
                    wordwrap($this->privateKey, 64, "\n", true) .
                    "\n-----END RSA PRIVATE KEY-----";
            }
            $this->privateKey = openssl_pkey_get_private($privateKey);
            if ($this->privateKey === false) {
                throw new InvalidConfigException(openssl_error_string());
            }

            if (is_file($this->publicKey)) {
                $publicKey = "file://" . $this->publicKey;
            } else {
                $publicKey = "-----BEGIN PUBLIC KEY-----\n" .
                    wordwrap($this->publicKey, 64, "\n", true) .
                    "\n-----END PUBLIC KEY-----";
            }
            $this->publicKey = openssl_pkey_get_public($publicKey);
            if ($this->publicKey === false) {
                throw new InvalidConfigException(openssl_error_string());
            }
            $this->initOpenSSL = true;
        }
    }
1284188
public function init()
    {
        if ($this->isConfigConsistent()) {
            $this->setSaml(new Saml(
                Metadata::load(
                    $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getIdpMetadataFile(),
                    $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getSpMetadataFile()
                ),
                $this->getConfig()->getPrivateKey()
            ));
        } else {
            $metadata = new Metadata();
            $metadata->setIdentityProvider(
                $metadata->createEntityDescriptor(
                    file_get_contents(
                        $this->getConfig()->getSamlMetadataBaseDir() . '/' .$this->getConfig()->getIdpMetadataFile()
                    )
                )
            );

            $this->setSaml(new Saml($metadata, $this->getConfig()->getPrivateKey()));
        }
    }