func (kms *GoogleCloudKMS) CreateSigningKey(ctx context.Context, parent, name string) (string, error) {
	result, err := kms.client.CreateCryptoKey(ctx, &kmspb.CreateCryptoKeyRequest{
		Parent:      parent,
		CryptoKeyId: name,
		CryptoKey: &kmspb.CryptoKey{
			Purpose: kmspb.CryptoKey_ASYMMETRIC_SIGN,
			VersionTemplate: &kmspb.CryptoKeyVersionTemplate{
				ProtectionLevel: kms.protectionLevel(),
				Algorithm:       kmspb.CryptoKeyVersion_EC_SIGN_P256_SHA256,
			},
		},
	})
	if err != nil {
		if grpcstatus.Code(err) == grpccodes.AlreadyExists {
			// The key already exists, just return it.
			return fmt.Sprintf("%s/cryptoKeys/%s", parent, name), nil
		}

		return "", fmt.Errorf("failed to create signing key: %w", err)
	}
	return result.Name, nil
}
// CreateSigningKey creates a new signing key in Cloud KMS. If a key already
// exists, it returns the existing key.
CreateSigningKey creates a new signing key in Cloud KMS. If a key already
exists, it returns the existing key.
// CreateSigningKey creates a new signing key in Cloud KMS . If a key already // exists it returns the existing key .
func (kms *GoogleCloudKMS) CreateSigningKey(ctx context.Context, parent, name string) (string, error) {
	result, err := kms.client.CreateCryptoKey(ctx, &kmspb.CreateCryptoKeyRequest{
		Parent:      parent,
		CryptoKeyId: name,
		CryptoKey: &kmspb.CryptoKey{
			Purpose: kmspb.CryptoKey_ASYMMETRIC_SIGN,
			VersionTemplate: &kmspb.CryptoKeyVersionTemplate{
				ProtectionLevel: kms.protectionLevel(),
				Algorithm:       kmspb.CryptoKeyVersion_EC_SIGN_P256_SHA256,
			},
		},
	})
	if err != nil {
		if grpcstatus.Code(err) == grpccodes.AlreadyExists {
			return fmt.Sprintf("%s/cryptoKeys/%s", parent, name), nil
		}
		return "", fmt.Errorf("failed to create signing key: %w", err)
	}
	return result.Name, nil
}
func ( kms * GoogleCloudKMS ) CreateSigningKey ( ctx context . Context , parent , name string ) ( string , error ) { result , err := kms . client . CreateCryptoKey ( ctx , & kmspb . CreateCryptoKeyRequest { Parent : parent , CryptoKeyId : name , CryptoKey : & kmspb . CryptoKey { Purpose : kmspb . CryptoKey_ASYMMETRIC_SIGN , VersionTemplate : & kmspb . CryptoKeyVersionTemplate { ProtectionLevel : kms . protectionLevel ( ) , Algorithm : kmspb . CryptoKeyVersion_EC_SIGN_P256_SHA256 , } , } , } ) if err != nil { if grpcstatus . Code ( err ) == grpccodes . AlreadyExists { return fmt . Sprintf ( " " , parent , name ) , nil } return " " , fmt . Errorf ( " " , err ) } return result . Name , nil }
CreateSigningKey creates a new signing key in Cloud KMS.
CreateSigningKey creates a new signing key in Cloud KMS .
// The key already exists, just return it.