Look up a public key from a username
548467
def key_from_keybase(username, fingerprint=None):
    """"""
    url = keybase_lookup_url(username)
    resp = requests.get(url)
    if resp.status_code == 200:
        j_resp = json.loads(polite_string(resp.content))
        if 'them' in j_resp and len(j_resp['them']) == 1:
            kb_obj = j_resp['them'][0]
            if fingerprint:
                return fingerprint_from_keybase(fingerprint, kb_obj)
            else:
                if 'public_keys' in kb_obj \
                   and 'pgp_public_keys' in kb_obj['public_keys']:
                    key = kb_obj['public_keys']['primary']
                    return massage_key(key)

    return None
1275547
def getkey(ctx, pubkey):
    
    click.echo(ctx.peerplays.wallet.getPrivateKeyForPublicKey(pubkey))
379215
private void extractUserKeys(URI dsnUri) {
        String userInfo = dsnUri.getUserInfo();
        if (userInfo == null) {
            return;
        }
        String[] userDetails = userInfo.split(":");
        publicKey = userDetails[0];
        if (userDetails.length > 1) {
            secretKey = userDetails[1];
        }
    }
1051772
def get_key(self, id):
        
        assert isinstance(id, (int, long)), id
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            "/user/keys/" + str(id)
        )
        return github.UserKey.UserKey(self._requester, headers, data, completed=True)
984919
def get_local_user(username):
    """"""
    try:
        _ = getpwnam(username)
        luser = username
    except KeyError:
        luser = getuser()
    return luser
721623
def get_by_username(cls, username):
        
        return cls.query().filter(cls.username == username).first()
777121
def get_username(identifier):
    """"""
    pattern = re.compile('.+@\w+\..+')
    if pattern.match(identifier):
        try:
            user = User.objects.get(email=identifier)
        except:
            raise Http404
        else:
            return user.username
    else:
        return identifier
325216
def find_user_by_username(self, username):
        """"""
        return self.db_adapter.ifind_first_object(self.UserClass, username=username)
813882
def _get_username_for_key(self):
        """"""
        response = self.client.get_access_key_last_used(
            AccessKeyId=self.compromised_resource['access_key_id']
        )
        username = response['UserName']
        return username
130324
def key_pair_paths(key_name):
    """"""
    public_key_path = os.path.expanduser("~/.ssh/{}.pub".format(key_name))
    private_key_path = os.path.expanduser("~/.ssh/{}.pem".format(key_name))
    return public_key_path, private_key_path
1086360
private RSAPublicKey getKeyForUser(String userName) throws KeyNotFoundException {
    RSAPublicKey key = null;
    for (final KeyProvider keyProvider : keyProviders) {
      try {
        key = keyProvider.getKey(userName);
        break;
      } catch (KeyNotFoundException e) {
        // that's fine, try the next provider
      }
    }

    if (key == null) {
      throw new KeyNotFoundException();
    }

    return key;
  }
962361
def get_password_from_keyring(entry=None, username=None):
    

    if username is None:
        username = get_username()

    has_keychain = initialize_keychain()

    # Unlock the user's keychain otherwise, if running under SSH, 'security(1)' will thrown an error.
    unlock_keychain(username)

    if has_keychain and entry is not None:
        try:
            return keyring.get_password(entry, username)
        except Exception as e:
            log.warn("Unable to get password from keyring. Continuing..")
            log.debug(e)

    return None
281414
def public(self, username=None):
        
        username = username or self.bitbucket.username or ''
        url = self.bitbucket.url('GET_USER', username=username)
        response = self.bitbucket.dispatch('GET', url)
        try:
            return (response[0], response[1]['repositories'])
        except TypeError:
            pass
        return response
1070470
def get_user(self, username):
        """"""
        ret = {}
        tmp = self._get_user(self._byte_p2(username), ALL_ATTRS)
        if tmp is None:
            raise UserDoesntExist(username, self.backend_name)
        attrs_tmp = tmp[1]
        for attr in attrs_tmp:
            value_tmp = attrs_tmp[attr]
            if len(value_tmp) == 1:
                ret[attr] = value_tmp[0]
            else:
                ret[attr] = value_tmp
        return ret
925167
def _get_private_key_obj(private_key, passphrase=None):
    '''
    
    '''
    private_key = _text_or_file(private_key)
    private_key = get_pem_entry(private_key, pem_type='(?:RSA )?PRIVATE KEY')
    rsaprivkey = M2Crypto.RSA.load_key_string(
        private_key, callback=_passphrase_callback(passphrase))
    evpprivkey = M2Crypto.EVP.PKey()
    evpprivkey.assign_rsa(rsaprivkey)
    return evpprivkey
801257
def user(self, username=None):
        """"""
        if username is None:
            username = self.__getUsername()
        parsedUsername = urlparse.quote(username)
        url = self.root + "/%s" % parsedUsername
        return User(url=url,
                    securityHandler=self._securityHandler,
                    proxy_url=self._proxy_url,
                    proxy_port=self._proxy_port,
                    initialize=False)
690535
public PublicKey getPublicKey() {
        if (info == null)
            return null;
        try {
            PublicKey key = (PublicKey)info.get(CertificateX509Key.NAME
                                + DOT + CertificateX509Key.KEY);
            return key;
        } catch (Exception e) {
            return null;
        }
    }