Check if the given OID is the Kerberos V5 OID (server mode).

        :param str desired_mech: The desired GSS-API mechanism of the client
        :return: ``True`` if the given OID is supported, otherwise C{False}
509184
def ssh_check_mech(self, desired_mech):
        
        from pyasn1.codec.der import decoder

        mech, __ = decoder.decode(desired_mech)
        if mech.__str__() != self._krb5_mech:
            return False
        return True
1195352
private boolean matchKerberosIdentities(WSConnectionRequestInfoImpl cri) {
        boolean flag = false;
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(this, tc, "matchKerberosIdentities", this, cri);

        if (kerberosIdentityisSet && cri.kerberosIdentityisSet) {
            flag = AdapterUtil.matchGSSName(cri.gssName, gssName);
        } else if (kerberosIdentityisSet || cri.kerberosIdentityisSet) {
            // one of them is true, so no match
            flag = false;
            if (isTraceOn && tc.isDebugEnabled()) 
                Tr.debug(this, tc, "only one has kerberos identity attributes set so no match");
        } else 
        {// else: both are are false thus, match
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(this, tc, "both have kerberos identity attributes not set so match");
            flag = true; 
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(this, tc, "matchKerberosIdentities", flag);

        return flag;
    }
978340
def _determine_auth_mechanism(username, password, delegation):
        
        if re.match('(.*)@(.+)', username) is not None:
            if delegation is True:
                raise Exception('Kerberos is not yet supported, specify the username in <domain>\<username> form for NTLM')
            else:
                raise Exception('Kerberos is not yet supported, specify the username in <domain>>\<username> form for NTLM')

        # check for NT format 'domain\username' a blank domain or username is invalid
        legacy = re.match('(.*)\\\\(.*)', username)
        if legacy is not None:
            if not legacy.group(1):
                raise Exception('Please specify the Windows domain for user in <domain>\<username> format')
            if not legacy.group(2):
                raise Exception('Please specify the Username of the user in <domain>\<username> format')
            if delegation is True:
                return HttpCredSSPAuth(legacy.group(1), legacy.group(2), password)
            else:
                return HttpNtlmAuth(legacy.group(1), legacy.group(2), password)

        #return HttpCredSSPAuth("SERVER2012", "Administrator", password)
        # attempt NTLM (local account, not domain) - if username is '' then we try anonymous NTLM auth
        # as if anyone will configure that - uf!
        return HttpNtlmAuth('', username, password)
686042
def isAuthorized(self, pid, action, vendorSpecific=None):
        """"""
        response = self.isAuthorizedResponse(pid, action, vendorSpecific)
        return self._read_boolean_401_response(response)
907766
private boolean setupEphemeralECDHKeys() {
        int index = -1;
        if (supportedCurves != null) {
            // if the client sent the supported curves extension, pick the
            // first one that we support;
            for (int curveId : supportedCurves.curveIds()) {
                if (SupportedEllipticCurvesExtension.isSupported(curveId)) {
                    index = curveId;
                    break;
                }
            }
            if (index < 0) {
                // no match found, cannot use this ciphersuite
                return false;
            }
        } else {
            // pick our preference
            index = SupportedEllipticCurvesExtension.DEFAULT.curveIds()[0];
        }
        String oid = SupportedEllipticCurvesExtension.getCurveOid(index);
        ecdh = new ECDHCrypt(oid, sslContext.getSecureRandom());
        return true;
    }
1196505
def start_kex(self):
        
        if self.transport.server_mode:
            self.transport._expect_packet(MSG_KEXGSS_GROUPREQ)
            return
        # request a bit range: we accept (min_bits) to (max_bits), but prefer
        # (preferred_bits).  according to the spec, we shouldn't pull the
        # minimum up above 1024.
        self.gss_host = self.transport.gss_host
        m = Message()
        m.add_byte(c_MSG_KEXGSS_GROUPREQ)
        m.add_int(self.min_bits)
        m.add_int(self.preferred_bits)
        m.add_int(self.max_bits)
        self.transport._send_message(m)
        self.transport._expect_packet(MSG_KEXGSS_GROUP)
1212704
def is_capable(cls, requested_capability):
        
        for c in requested_capability:
            if not c in cls.capability:
                return False
        return True
41731
def check_channel_pty_request(self, channel, term, width, height, pixelwidth,
                                  pixelheight, modes):
        ''''''
        #self.sshterm = term
        #print "term: %r, modes: %r" % (term, modes)
        log.debug('PTY requested.  Setting up %r.', self.telnet_handler)
        pty_thread = Thread( target=self.start_pty_request, args=(channel, term, modes) )
        self.channels[channel] = pty_thread
        
        return True
246093
@Override
	public boolean isMachineRunning( TargetHandlerParameters parameters, String machineId )
	throws TargetException {
		// TODO remove next line when APIs get compatible...
		String postfix = (parameters.getTargetProperties().get(CloudautomationMixins.PROVIDER_ENDPOINT) != null ? "" : "/compute");
		return OcciVMUtils.isVMRunning(parameters.getTargetProperties().get(SERVER_IP_PORT) + postfix, machineId);
	}
970749
function getDefaultAuthMechanism(ismaster) {
  if (ismaster) {
    // If ismaster contains saslSupportedMechs, use scram-sha-256
    // if it is available, else scram-sha-1
    if (Array.isArray(ismaster.saslSupportedMechs)) {
      return ismaster.saslSupportedMechs.indexOf('SCRAM-SHA-256') >= 0
        ? 'scram-sha-256'
        : 'scram-sha-1';
    }

    // Fallback to legacy selection method. If wire version >= 3, use scram-sha-1
    if (ismaster.maxWireVersion >= 3) {
      return 'scram-sha-1';
    }
  }

  // Default for wireprotocol < 3
  return 'mongocr';
}
1287309
def is_supported(self, target):
        
        if target.lower() not in self.targets_mcu_list:
            logging.debug("Target not found in definitions")
            return False
        mcu_record = self.targets.get_mcu_record(target) if self.mcus.get_mcu_record(target) is None else self.mcus.get_mcu_record(target)
        # Look at tool specific options which define tools supported for target
        # TODO: we might create a list of what tool requires
        if self.tool:
            # tool_specific requested look for it
            try:
                for k,v in mcu_record['tool_specific'].items():
                    if k == self.tool:
                        return True
            except (TypeError, KeyError) as err:
                pass
            return False
        else:
            # supports generic part (mcu part)
            return True
529309
def key?(host)
      Gem::Keychain.has_api_key?(host: host) || @fallback.key?(host.to_s)
    end
776785
def client_mechanisms(self):
        """"""
        return [mech for mech in self.mechs.values()
                if isinstance(mech, ClientMechanism)]
385377
def _send_kex_init(self):
        
        self.clear_to_send_lock.acquire()
        try:
            self.clear_to_send.clear()
        finally:
            self.clear_to_send_lock.release()
        self.in_kex = True
        if self.server_mode:
            if (self._modulus_pack is None) and ('diffie-hellman-group-exchange-sha1' in self._preferred_kex):
                # can't do group-exchange if we don't have a pack of potential primes
                pkex = list(self.get_security_options().kex)
                pkex.remove('diffie-hellman-group-exchange-sha1')
                self.get_security_options().kex = pkex
            available_server_keys = filter(self.server_key_dict.keys().__contains__,
                                           self._preferred_keys)
        else:
            available_server_keys = self._preferred_keys

        m = Message()
        m.add_byte(chr(MSG_KEXINIT))
        m.add_bytes(rng.read(16))
        m.add_list(self._preferred_kex)
        m.add_list(available_server_keys)
        m.add_list(self._preferred_ciphers)
        m.add_list(self._preferred_ciphers)
        m.add_list(self._preferred_macs)
        m.add_list(self._preferred_macs)
        m.add_list(self._preferred_compression)
        m.add_list(self._preferred_compression)
        m.add_string('')
        m.add_string('')
        m.add_boolean(False)
        m.add_int(0)
        # save a copy for later (needed to compute a hash)
        self.local_kex_init = str(m)
        self._send_message(m)
931241
private void chooseCipherSuite(ClientHello mesg) throws IOException {
        for (CipherSuite suite : mesg.getCipherSuites().collection()) {
            if (isNegotiable(suite) == false) {
                continue;
            }

            if (doClientAuth == SSLEngineImpl.clauth_required) {
                if ((suite.keyExchange == K_DH_ANON) ||
                    (suite.keyExchange == K_ECDH_ANON)) {
                    continue;
                }
            }
            if (trySetCipherSuite(suite) == false) {
                continue;
            }
            return;
        }
        fatalSE(Alerts.alert_handshake_failure,
                    "no cipher suites in common");
    }
31876
def get_client(self, name):
        
        mech = self.get(name)
        return mech if isinstance(mech, ClientMechanism) else None
647788
def is_suitable(self, request):
        
        if self.key_type:
            validation = KEY_TYPE_VALIDATIONS.get( self.get_type() )
            return validation( request ) if validation else None
        return True