r"""
        The `SSHKey`'s ``id`` field, or if that is not defined, its
        ``fingerprint`` field.  If neither field is defined, accessing this
        attribute raises a `TypeError`.
198020
def _id(self):
        
        """
        if self.get("id") is not None:
            return self.id
        elif self.get("fingerprint") is not None:
            return self.fingerprint
        else:
            raise TypeError('SSHKey has neither .id nor .fingerprint')
456671
def key_exists(self, key, secret=False):
        '''
        
        '''
        if len(key) < 8:
            return False
        key = key.upper()
        res = self.list_keys(secret)
        for fingerprint in res.keys:
            if fingerprint.endswith(key):
                return True
        return False
266191
def fingerprint_path(cls, user, fingerprint):
        """"""
        return google.api_core.path_template.expand(
            "users/{user}/sshPublicKeys/{fingerprint}",
            user=user,
            fingerprint=fingerprint,
        )
105632
def finger_all(self, hash_type=None):
        '''
        
        '''
        if hash_type is None:
            hash_type = __opts__['hash_type']

        ret = {}
        for status, keys in six.iteritems(self.all_keys()):
            ret[status] = {}
            for key in keys:
                if status == 'local':
                    path = os.path.join(self.opts['pki_dir'], key)
                else:
                    path = os.path.join(self.opts['pki_dir'], status, key)
                ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type)
        return ret
637223
def id_(reset=False):
    '''
    
    '''
    if reset:
        id_pattern = re.compile(r'Monit id (?P<id>[^ ]+)')
        cmd = 'echo y|monit -r'
        out = __salt__['cmd.run_all'](cmd, python_shell=True)
        ret = id_pattern.search(out['stdout']).group('id')
        return ret if ret else False
    else:
        cmd = 'monit -i'
        out = __salt__['cmd.run'](cmd)
        ret = out.split(':')[-1].strip()
    return ret
1165430
def get_id(name=None, cidr=None, tags=None, region=None, key=None, keyid=None,
           profile=None):
    '''
    

    '''

    try:
        return {'id': _get_id(vpc_name=name, cidr=cidr, tags=tags, region=region,
                              key=key, keyid=keyid, profile=profile)}
    except BotoServerError as e:
        return {'error': __utils__['boto.get_error'](e)}
943310
def process_ssh_line(self, data, name, idx):
        
        data = data.strip()
        if not contains(data, 'ssh-rsa'):
            return

        # strip ssh params / adjustments
        try:
            data = data[to_bytes(data).find(b'ssh-rsa'):]
        except Exception as e:
            pass

        from cryptography.hazmat.primitives.serialization import load_ssh_public_key
        from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey
        try:
            key_obj = load_ssh_public_key(data, self.get_backend())
            self.num_ssh += 1

            if not isinstance(key_obj, RSAPublicKey):
                return

            self.num_rsa += 1
            numbers = key_obj.public_numbers()

            js = collections.OrderedDict()
            js['type'] = 'ssh-rsa'
            js['fname'] = name
            js['idx'] = idx
            js['e'] = '0x%x' % numbers.e
            js['n'] = '0x%x' % numbers.n
            js['ssh'] = data

            if self.has_fingerprint(numbers.n):
                logger.warning('Fingerprint found in the SSH key %s idx %s ' % (name, idx))
                self.mark_and_add_effort(numbers.n, js)

                if self.do_print:
                    print(json.dumps(js))

            return TestResult(js)

        except Exception as e:
            logger.debug('Exception in processing SSH public key %s idx %s : %s' % (name, idx, e))
            self.trace_logger.log(e)
1255351
def doc_id(self):
        
        if self.id:
            return '%s_%s' % (self.doc_type, self.id.lower())
        return self._hashed_key
1131650
def fingerprint(self, option_type, option_val):
    
    if option_val is None:
      return None

    # Wrapping all other values in a list here allows us to easily handle single-valued and
    # list-valued options uniformly. For non-list-valued options, this will be a singleton list
    # (with the exception of dict, which is not modified). This dict exception works because we do
    # not currently have any "list of dict" type, so there is no ambiguity.
    if not isinstance(option_val, (list, tuple, dict)):
      option_val = [option_val]

    if option_type == target_option:
      return self._fingerprint_target_specs(option_val)
    elif option_type == dir_option:
      return self._fingerprint_dirs(option_val)
    elif option_type == file_option:
      return self._fingerprint_files(option_val)
    elif option_type == dict_with_files_option:
      return self._fingerprint_dict_with_files(option_val)
    else:
      return self._fingerprint_primitives(option_val)
118313
def p_field_id(self, p):
        ''' '''
        if len(p) == 3:

            if p[1] == 0:
                # Prevent users from ever using field ID 0. It's reserved for
                # internal use only.
                raise ThriftParserError(
                    'Line %d: Field ID 0 is reserved for internal use.'
                    % p.lineno(1)
                )

            p[0] = p[1]
        else:
            p[0] = None
1056328
def identify(self, obj):
    """"""
    hash_ = hash(obj)
    type_id = self.to_id(type(obj))
    return (hash_, TypeId(type_id))
488194
def identifier(key)
      key &&= key.to_sym
      return unless Rudy::ID_MAP.has_key?(key)
      Rudy::ID_MAP[key]
    end
390957
def fingerprint(value):
  """"""
  h = hashlib.sha256()
  _digest(value, h)
  return h.digest().encode('hex')
92043
def usable_id(cls, id):
        
        try:
            # id is maybe a hostname
            qry_id = cls.from_name(id)
            if not qry_id:
                # id is maybe an ip
                qry_id = cls.from_ip(id)
            if not qry_id:
                qry_id = cls.from_vhost(id)
        except Exception:
            qry_id = None

        if not qry_id:
            msg = 'unknown identifier %s' % id
            cls.error(msg)

        return qry_id
538679
def gpg_fingerprint(key):
    """"""
    if (len(key) == 8 and re.match(r'^[0-9A-F]{8}$', key)) or \
       (len(key) == 40 and re.match(r'^[0-9A-F]{40}$', key)):
        return

    raise aomi.exceptions.Validation('Invalid GPG Fingerprint')
544520
def int_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, int):
            return id_or_name
        return None
1007732
def finger(self, match, hash_type=None):
        '''
        
        '''
        if hash_type is None:
            hash_type = __opts__['hash_type']

        matches = self.name_match(match, True)
        ret = {}
        for status, keys in six.iteritems(matches):
            ret[status] = {}
            for key in keys:
                if status == 'local':
                    path = os.path.join(self.opts['pki_dir'], key)
                else:
                    path = os.path.join(self.opts['pki_dir'], status, key)
                ret[status][key] = salt.utils.crypt.pem_finger(path, sum_type=hash_type)
        return ret