Extracts a key matching a specific fingerprint from a
    Keybase API response
778630
def fingerprint_from_keybase(fingerprint, kb_obj):
    """"""
    if 'public_keys' in kb_obj and \
       'pgp_public_keys' in kb_obj['public_keys']:
        for key in kb_obj['public_keys']['pgp_public_keys']:
            keyprint = fingerprint_from_var(key).lower()
            fingerprint = fingerprint.lower()
            if fingerprint == keyprint or \
               keyprint.startswith(fingerprint) or \
               keyprint.endswith(fingerprint):
                return {
                    'fingerprint': keyprint,
                    'bundle': key
                }

    return None
390957
def fingerprint(value):
  """"""
  h = hashlib.sha256()
  _digest(value, h)
  return h.digest().encode('hex')
200510
def addresses_for_key(gpg, key):
    
    return [address.split("<")[-1].strip(">")
            for address in gpg.list_keys().key_map[key['fingerprint']]["uids"]
            if address]
434765
def _extract_lookup(self, key):
        """"""
        parts = key.split('__')
        # 'exact' is the default lookup if there was no explicit comparison op in `key`
        #   Assume there is only one `__` in the key.
        #   FIXME Change for child attribute query support
        op = 'exact' if len(parts) == 1 else parts[1]

        # Construct and assign the lookup class as a filter criteria
        return parts[0], self.get_lookup(op)
970872
def export_public_key(vk, label):
    
    key_type, blob = serialize_verifying_key(vk)
    log.debug('fingerprint: %s', fingerprint(blob))
    b64 = base64.b64encode(blob).decode('ascii')
    return u'{} {} {}\n'.format(key_type.decode('ascii'), b64, label)
1144818
static long fingerprint(byte[] bytes, int offset, int length) {
        if (length <= 32) {
            if (length <= 16) {
                return hashLength0to16(bytes, offset, length);
            } else {
                return hashLength17to32(bytes, offset, length);
            }
        } else if (length <= 64) {
            return hashLength33To64(bytes, offset, length);
        } else {
            return hashLength65Plus(bytes, offset, length);
        }
    }
293326
def fingerprint(blob):
    
    digest = hashlib.md5(blob).digest()
    return ':'.join('{:02x}'.format(c) for c in bytearray(digest))
758007
def retrieve_by_key_identifier(self, key_identifier):
        

        if not isinstance(key_identifier, byte_cls):
            raise TypeError(pretty_message(
                '''
                key_identifier must be a byte string, not %s
                ''',
                type_name(key_identifier)
            ))

        return self._key_identifier_map.get(key_identifier)
1145475
def parse_pubkey(blob):
    
    fp = fingerprint(blob)
    s = io.BytesIO(blob)
    key_type = util.read_frame(s)
    log.debug('key type: %s', key_type)
    assert key_type in SUPPORTED_KEY_TYPES, key_type

    result = {'blob': blob, 'type': key_type, 'fingerprint': fp}

    if key_type == SSH_NIST256_KEY_TYPE:
        curve_name = util.read_frame(s)
        log.debug('curve name: %s', curve_name)
        point = util.read_frame(s)
        assert s.read() == b''
        _type, point = point[:1], point[1:]
        assert _type == SSH_NIST256_DER_OCTET
        size = len(point) // 2
        assert len(point) == 2 * size
        coords = (util.bytes2num(point[:size]), util.bytes2num(point[size:]))

        curve = ecdsa.NIST256p
        point = ecdsa.ellipticcurve.Point(curve.curve, *coords)

        def ecdsa_verifier(sig, msg):
            assert len(sig) == 2 * size
            sig_decode = ecdsa.util.sigdecode_string
            vk = ecdsa.VerifyingKey.from_public_point(point, curve, hashfunc)
            vk.verify(signature=sig, data=msg, sigdecode=sig_decode)
            parts = [sig[:size], sig[size:]]
            return b''.join([util.frame(b'\x00' + p) for p in parts])

        result.update(point=coords, curve=CURVE_NIST256,
                      verifier=ecdsa_verifier)

    if key_type == SSH_ED25519_KEY_TYPE:
        pubkey = util.read_frame(s)
        assert s.read() == b''

        def ed25519_verify(sig, msg):
            assert len(sig) == 64
            vk = ed25519.VerifyingKey(pubkey)
            vk.verify(sig, msg)
            return sig

        result.update(curve=CURVE_ED25519, verifier=ed25519_verify)

    return result
1155599
def get_from_human_key(self, key):
        """"""
        if key in self._identifier_map:
            return self._identifier_map[key]
        raise KeyError(key)
340706
def describe_keypairs(self, xml_bytes):
        
        results = []
        root = XML(xml_bytes)
        keypairs = root.find("keySet")
        if keypairs is None:
            return results
        for keypair_data in keypairs:
            key_name = keypair_data.findtext("keyName")
            key_fingerprint = keypair_data.findtext("keyFingerprint")
            results.append(model.Keypair(key_name, key_fingerprint))
        return results
429074
def match_to_key(match, path, location)
      key   = super
      scope = match[1]
      if scope
        scope_parts = extract_literal_or_array_of_literals(scope)
        return nil if scope_parts.nil? || scope_parts.empty?
        "#{scope_parts.join('.')}.#{key}"
      else
        key unless match[0] =~ /\A\w/
      end
    end
177885
def compute_fingerprint(self, target):
    
    if isinstance(target, UnpackedJars):
      hasher = sha1()
      for cache_key in sorted(jar.cache_key() for jar in target.all_imported_jar_deps):
        hasher.update(cache_key.encode('utf-8'))
      hasher.update(target.payload.fingerprint().encode('utf-8'))
      return hasher.hexdigest() if PY3 else hasher.hexdigest().decode('utf-8')
    return None
870129
def fingerprint_from_file(filename):
    """"""
    cmd = flatten([gnupg_bin(), gnupg_home(), filename])
    outp = stderr_output(cmd).split('\n')
    if not outp[0].startswith('pub'):
        raise CryptoritoError('probably an invalid gpg key')

    return outp[1].strip()
52110
function _getDigiTrustObject(key) {
  function getDigiTrustId() {
    let digiTrustUser = window.DigiTrust && (config.getConfig('digiTrustId') || window.DigiTrust.getUser({member: key}));
    return (digiTrustUser && digiTrustUser.success && digiTrustUser.identity) || null;
  }
  let digiTrustId = getDigiTrustId();
  // Verify there is an ID and this user has not opted out
  if (!digiTrustId || (digiTrustId.privacy && digiTrustId.privacy.optout)) {
    return null;
  }
  return digiTrustId;
}
276042
function getFingerprintForURL(url) {
	var domain = getDomain(url);
	var found = global.requestSSLFingerprints[domain];
	debug('getFingerprintForURL %s -> %s=%s',url,domain,found);
	if (!found) {
		// try a wildcard search
		var u = urlib.parse(domain),
			tokens = (u && u.host || domain).split('.');
		domain = '*.'+tokens.splice(tokens.length > 1 ? 0 : 1).join('.');
		found = global.requestSSLFingerprints[domain];
		debug('getFingerprintForURL (wildcard) %s -> %s=%s',url,domain,found);
	}
	return found;
}
182521
def get_signing_key(self):
        

        """
        Download a local copy of repo signing key key metadata.
        Fixes #17 Scan Keys no available in all GPG versions.
        """
        tmp_key_path = "/tmp/{0}".format(self.repo_signing_key)
        tmp_metadata_path = "/tmp/{0}".format(self.key_metadata)

        repo_key_path = "{0}/{1}".format(self.url, self.repo_signing_key)
        repo_metadata_path = "{0}/{1}".format(self.url, self.key_metadata)


        req_key = requests.get(repo_key_path)
        req_metadata = requests.get(repo_metadata_path)

        # Fetch the key to disk
        if req_key.status_code is 200:
            logger.debug(("found repository signing key at "
                          "{0}".format(repo_key_path)))
            self.raw_key = req_key.content
            with open(tmp_key_path, 'wb') as f:
                f.write(self.raw_key)
        else:
            raise RepositoryMissingSigningKeyError(repo_key_path)

        # Fetch the fingerprint from the metadata
        if req_metadata.status_code is 200:
            logger.debug(("found key metadata at "
                          "{0}".format(repo_metadata_path)))
            print(req_metadata.content)
            key_info = json.loads(req_metadata.content.decode('utf-8'))
        else:
            RepositoryMissingKeyMetadataError

        return (tmp_key_path, key_info)