func (g *GoogleKMS) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) {
	// API expects the digest to be base64 encoded
	digest256 := sha256.New()
	digest256.Write(digest)

	req := &kmspb.AsymmetricSignRequest{
		Name: g.keyResourceId,
		Digest: &kmspb.Digest{
			Digest: &kmspb.Digest_Sha256{
				Sha256: digest256.Sum(nil),
			},

		},
	}

	response, err := g.Client.AsymmetricSign(context.Background(), req)
	if err != nil {
		return nil, err
	}

	// The response signature is base64 encoded
	return response.Signature, nil
}
// Sign calls Google Cloud KMS API and performs AsymmetricSign
Sign calls Google Cloud KMS API and performs AsymmetricSign
// Sign calls Google Cloud KMS API and performs AsymmetricSign
func (g *GoogleKMS) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) {
	digest256 := sha256.New()
	digest256.Write(digest)
	req := &kmspb.AsymmetricSignRequest{
		Name: g.keyResourceId,
		Digest: &kmspb.Digest{
			Digest: &kmspb.Digest_Sha256{
				Sha256: digest256.Sum(nil),
			},
		},
	}
	response, err := g.Client.AsymmetricSign(context.Background(), req)
	if err != nil {
		return nil, err
	}
	return response.Signature, nil
}
func ( g * GoogleKMS ) Sign ( rand io . Reader , digest [ ] byte , opts crypto . SignerOpts ) ( signature [ ] byte , err error ) { digest256 := sha256 . New ( ) digest256 . Write ( digest ) req := & kmspb . AsymmetricSignRequest { Name : g . keyResourceId , Digest : & kmspb . Digest { Digest : & kmspb . Digest_Sha256 { Sha256 : digest256 . Sum ( nil ) , } , } , } response , err := g . Client . AsymmetricSign ( context . Background ( ) , req ) if err != nil { return nil , err } return response . Signature , nil }
Sign calls Google Cloud KMS API and performs AsymmetricSign
Sign calls Google Cloud KMS API and performs AsymmetricSign
// API expects the digest to be base64 encoded // The response signature is base64 encoded