// GetPublicKeyByLabel Gets the public key associated with this label
774943
func (u *User) GetPublicKeyByLabel(label string) (publicKey PublicKey, err error) {
	for _, publicKey = range u.PublicKeys {
		if publicKey.Label == label {
			return
		}
	}
	err = errors.New("Could not find PublicKey with label " + label)
	return
}
919809
func GetLabelOfRepoByName(repoID int64, labelName string) (*Label, error) {
	return getLabelOfRepoByName(x, repoID, labelName)
}
1215451
func (lu *LocalUser) GetPublicKeys() []keybase1.PublicKey {
	sibkeys := verifyingKeysToPublicKeys(lu.VerifyingKeys)
	subkeys := cryptPublicKeysToPublicKeys(lu.CryptPublicKeys)
	return append(sibkeys, subkeys...)
}
1204276
func (ve *SignerValidatorEndpoint) GetPubKey() crypto.PubKey {
	ve.mtx.Lock()
	defer ve.mtx.Unlock()
	return ve.signer.GetPubKey()
}
1222450
func (api UsersAPI) DeletePublicKey(w http.ResponseWriter, r *http.Request) {
	username := mux.Vars(r)["username"]
	label := mux.Vars(r)["label"]
	userMgr := user.NewManager(r)

	usr, err := userMgr.GetByName(username)
	if err != nil {
		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
		return
	}

	_, err = usr.GetPublicKeyByLabel(label)
	if err != nil {
		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
		return
	}

	if err := userMgr.RemovePublicKey(username, label); err != nil {
		log.Error("ERROR while removing public key:\n", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	w.WriteHeader(http.StatusNoContent)
}
468647
func (p *PullRequestBranch) GetLabel() string {
	if p == nil || p.Label == nil {
		return ""
	}
	return *p.Label
}
1053638
func formatPublicKeyFingerprint(key ssh.PublicKey, display bool) string {
	publicKeyFingerprint := md5.New()
	publicKeyFingerprint.Write(key.Marshal())
	publicKeyFingerprintString := fmt.Sprintf("%x", publicKeyFingerprint.Sum(nil))

	if !display {
		return publicKeyFingerprintString
	}

	formatted := ""
	for i := 0; i < len(publicKeyFingerprintString); i = i + 2 {
		formatted = fmt.Sprintf("%s%s:", formatted, publicKeyFingerprintString[i:i+2])
	}

	return strings.TrimSuffix(formatted, ":")
}
884275
func (_class GPUGroupClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []GPUGroupRef, _err error) {
	_method := "GPU_group.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertGPUGroupRefSetToGo(_method + " -> ", _result.Value)
	return
}
997973
func (u *User) GetPublicGists() int {
	if u == nil || u.PublicGists == nil {
		return 0
	}
	return *u.PublicGists
}
256236
func getPublicKey(keyURL string) (*rsa.PublicKey, error) {

	/* Connect to the server to fetch Key details */
	r, err := http.Get(keyURL)
	if err != nil {
		return nil, err
	}

	defer r.Body.Close()

	/* Decode the SSO Key */
	ssoKey := &ssoKey{}
	err = json.NewDecoder(r.Body).Decode(ssoKey)
	if err != nil {
		return nil, err
	}

	/* Retrieve the Public Key from SSO Key */
	publicKey, err := crypto.ParseRSAPublicKeyFromPEM([]byte(ssoKey.Value))
	if err != nil {
		return nil, err
	}
	return publicKey, nil

}
1129654
func ExtractPublicKey(data []byte) (key [32]byte, err error) {
	var (
		obj map[string]interface{}
		ks  string
		ok  bool
		bs  []byte
	)
	err = json.Unmarshal(data, &obj)
	if err != nil {
		return
	}
	k, ok := obj[PublicKeyField]
	if !ok {
		goto missing
	}
	ks, ok = k.(string)
	if !ok {
		goto invalid
	}
	if len(ks) != 64 {
		goto invalid
	}
	bs, err = hex.DecodeString(ks)
	if err != nil {
		goto invalid
	}
	if len(bs) != 32 {
		goto invalid
	}
	copy(key[:], bs)
	return
missing:
	err = ErrPublicKeyMissing
	return
invalid:
	err = ErrPublicKeyInvalid
	return
}
470509
func (_class VMApplianceClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []VMApplianceRef, _err error) {
	_method := "VM_appliance.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVMApplianceRefSetToGo(_method + " -> ", _result.Value)
	return
}
534661
func (g *GPGKey) GetPublicKey() string {
	if g == nil || g.PublicKey == nil {
		return ""
	}
	return *g.PublicKey
}
701530
func (m *Milestone) GetLabelsURL() string {
	if m == nil || m.LabelsURL == nil {
		return ""
	}
	return *m.LabelsURL
}
1058567
func (key *Key) GetPublicKey() (*rsa.PublicKey, error) {
	modulus, err := key.GetModulus()
	if err != nil {
		return nil, err
	}
	exponent, err := key.GetExponent()
	if err != nil {
		return nil, err
	}
	pk := &rsa.PublicKey{
		N: new(big.Int).SetBytes(modulus),
		E: int(exponent),
	}
	return pk, nil
}
778536
func (k SigningSecretKey) GetRawPublicKey() *[ed25519.PublicKeySize]byte {
	return (*[ed25519.PublicKeySize]byte)(&k.pub)
}
1146313
func (x *XC) findPublicKey(needle string) (*keyring.PublicKey, error) {
	for _, id := range x.pubring.KeyIDs() {
		if id == needle {
			return x.pubring.Get(id), nil
		}
	}
	return nil, fmt.Errorf("no sender found for id '%s'", needle)
}