// UpdatePublicKey updates given public key.
540158
func UpdatePublicKey(key *PublicKey) error {
	_, err := x.Id(key.ID).AllCols().Update(key)
	return err
}
1156182
func (s *UserProfileSummary) SetSshPublicKey(v string) *UserProfileSummary {
	s.SshPublicKey = &v
	return s
}
1015632
func (pssapi *API) GetPublicKey() (keybytes hexutil.Bytes) {
	key := pssapi.Pss.PublicKey()
	keybytes = crypto.FromECDSAPub(key)
	return keybytes
}
236049
func (s *DevEndpoint) SetPublicKey(v string) *DevEndpoint {
	s.PublicKey = &v
	return s
}
159241
func (r *JWKSArgs) PopulatePublicKey() error {
	insecureClient := &http.Client{Transport: newCustomHTTPTransport(true)}
	client := &http.Client{Transport: newCustomHTTPTransport(false)}
	resp, err := client.Get(r.URL.String())
	if err != nil {
		resp, err = insecureClient.Get(r.URL.String())
		if err != nil {
			return err
		}
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return errors.New(resp.Status)
	}

	var jwk JWKS
	if err = json.NewDecoder(resp.Body).Decode(&jwk); err != nil {
		return err
	}

	r.publicKeys = make(map[string]crypto.PublicKey)
	for _, key := range jwk.Keys {
		var publicKey crypto.PublicKey
		publicKey, err = key.DecodePublicKey()
		if err != nil {
			return err
		}
		r.publicKeys[key.Kid] = publicKey
	}

	return nil
}
300964
func expandPublicKey(key []byte) (*big.Int, *big.Int) {
	Y := big.NewInt(0)
	X := big.NewInt(0)
	X.SetBytes(key[1:])

	// y^2 = x^3 + ax^2 + b
	// a = 0
	// => y^2 = x^3 + b
	ySquared := big.NewInt(0)
	ySquared.Exp(X, big.NewInt(3), nil)
	ySquared.Add(ySquared, curveParams.B)

	Y.ModSqrt(ySquared, curveParams.P)

	Ymod2 := big.NewInt(0)
	Ymod2.Mod(Y, big.NewInt(2))

	signY := uint64(key[0]) - 2
	if signY != Ymod2.Uint64() {
		Y.Sub(curveParams.P, Y)
	}

	return X, Y
}
510745
func IDFromPublicKey(pk ic.PubKey) (ID, error) {
	b, err := pk.Bytes()
	if err != nil {
		return "", err
	}
	var alg uint64 = mh.SHA2_256
	if AdvancedEnableInlining && len(b) <= maxInlineKeyLength {
		alg = mh.ID
	}
	hash, _ := mh.Sum(b, alg, -1)
	return ID(hash), nil
}
534661
func (g *GPGKey) GetPublicKey() string {
	if g == nil || g.PublicKey == nil {
		return ""
	}
	return *g.PublicKey
}
1307328
func PEMFromRSAPublicKey(key crypto.PublicKey, headers map[string]string) ([]byte, error) {
	pkey, err := verifyRSAPublicKey(key)
	if err != nil {
		return nil, err
	}
	marshalled, err := x509.MarshalPKIXPublicKey(pkey)
	if err != nil {
		return []byte{}, err
	}
	block := pem.Block{
		Type:    "PUBLIC KEY",
		Headers: headers,
		Bytes:   marshalled,
	}
	bytes := pem.EncodeToMemory(&block)
	return bytes, nil
}
474997
func (s *UpdateMyUserProfileInput) SetSshPublicKey(v string) *UpdateMyUserProfileInput {
	s.SshPublicKey = &v
	return s
}
1128723
func (k *rsaPrivateKey) PublicKey() (bccsp.Key, error) {
	return &rsaPublicKey{&k.privKey.PublicKey}, nil
}
1086061
func (l *LightningNode) AddPubKey(key *btcec.PublicKey) {
	l.pubKey = key
	copy(l.PubKeyBytes[:], key.SerializeCompressed())
}
403116
func ValidatePublicKey(k *ecdsa.PublicKey) bool {
	return k != nil && k.X != nil && k.Y != nil && k.X.Sign() != 0 && k.Y.Sign() != 0
}
195411
func ParsePublicKeyDER(der []byte) (crypto.PublicKey, error) {
	generalKey, err := x509.ParsePKIXPublicKey(der)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return generalKey, nil
}
61463
func (s *CreateRemoteAccessSessionInput) SetSshPublicKey(v string) *CreateRemoteAccessSessionInput {
	s.SshPublicKey = &v
	return s
}
1320269
func (e *Engine) SignedPublicKey(ctx context.Context, body *primitive.PublicKey,
	sigID *identity.ID, sigKP *SignatureKeyPair) (*envelope.PublicKey, error) {
	id, sig, err := e.signAndID(ctx, body, sigID, sigKP)
	if err != nil {
		return nil, err
	}

	return &envelope.PublicKey{
		ID:        id,
		Version:   uint8(body.Version()),
		Body:      body,
		Signature: *sig,
	}, nil
}
641153
func (s *RegisterUsageInput) SetPublicKeyVersion(v int64) *RegisterUsageInput {
	s.PublicKeyVersion = &v
	return s
}