Docs HomeMongoDB Compass

In-Use Encryption Tutorial使用中的加密教程

Queryable Encryption is in Public Preview and available for evaluation purposes. 可查询加密在公共预览中,可用于评估目的。Public Preview is not recommended for production deployments as breaking changes may be introduced. 生产部署不建议使用公共预览,因为可能会引入破坏性更改。To learn more about the Preview please see the Queryable Encryption Preview blog post.要了解有关预览的更多信息,请参阅可查询的加密预览博客文章。

In-Use Encryption allows you to connect to your deployments using Queryable Encryption. This connection method allows you to encrypt a subset of fields in your collections.使用中加密允许您使用可查询加密连接到部署。此连接方法允许您加密集合中的字段子集。

You can also use CSFLE to encrypt a subset of fields in your collection. CSFLE encryption is enabled through the schema editor.您还可以使用CSFLE对集合中的字段子集进行加密。CSFLE加密是通过模式编辑器启用的。

Overview概述

This guide shows you how to connect to your deployment and collections using Queryable Encryption.本指南向您展示如何使用Queryable Encryption连接到部署和集合。

This guide uses the air_airlines.json data set in the guided examples. The guide covers the process of importing your data set.本指南使用了示例中的air_airlines.json数据集。本指南介绍了导入数据集的过程。

Requirements and Limitations要求和限制

  • In-Use Encryption is an Enterprise/Atlas only feature.在用加密是仅限企业/Atlas的功能。
  • You need a replica set to use this connection option. Your replica set can be a single node or larger.您需要一个副本集才能使用此连接选项。您的复制副本集可以是单个节点,也可以是更大的节点。
  • You need to connect to your deployment on Compass using In-Use Encryption. 您需要使用在用加密连接到Compass上的部署。For more information on how to connect to your deployment, see In-Use Encryption Connection tab.有关如何连接到部署的更多信息,请参阅使用中的加密连接选项卡

Create Your Encrypted Collection创建加密集合

Once your deployment is connected using In-Use Encryption, create your collection using Queryable Encryption. 使用In-Use Encryption连接部署后,请使用Queryable Encryption创建集合。You can create a new database and collection or you can create a new collection in an existing database.您可以创建新的数据库和集合,也可以在现有数据库中创建新的集合。

Procedure过程

1

Click the Create a Database button or the Create a Collection button.单击“创建数据库”按钮或“创建集合”按钮。

Enter the name of the database and/or collection.输入数据库和/或集合的名称。

2

Click the Advanced Collection Options drop down.单击“高级集合选项”下拉菜单。

3

Check the Queryable Encryption box.选中“可查询加密”框。

4

Specify your Encrypted Fields.指定“加密字段”。

Change the path field value from encryptedField to the name of the field you want encrypted.path字段值从encryptedField更改为要加密的字段的名称。

Encrypted Field Name

Here, the encrypted field is the base field of the air_airlines data set.这里,加密字段是air_airlines数据集的path字段。

For more information, see Encrypted Fields.有关详细信息,请参阅加密字段

5

KMS Provider.KMS提供程序。

6

Key Encryption Key.键加密键。

7

Click Create Database or Create Collection.单击“创建数据库”或“创建集合”。

Import Your Data导入您的数据

1

Click on your collection on the left-hand navigation banner.单击左侧导航横幅上的集合。

The collection has a Queryable Encryption badge next to its name to indicate that fields in that collection are encrypted.集合的名称旁边有一个“可查询加密”徽章,用于指示该集合中的字段已加密。

2

Click Add Data.单击“添加数据”。

3

Click Import File.单击“导入文件”。

4

Select File and Input File Type.选择“文件”和“输入文件类型”。

5

Click Import.单击“导入”。

Your imported collection is displayed in the document view. 导入的集合将显示在文档视图中。The specified encrypted field is marked by a key symbol next to the value.指定的加密字段由值旁边的键符号标记。

Encrypted Field

Here, the base field is marked with the key symbol.在这里,base字段用关键符号进行标记。

Enable and Disable In-Use Encryption启用和禁用在用加密

You can enable and disable In-Use Encryption in your deployment.您可以在部署中启用和禁用使用中加密。

When In-Use Encryption is enabled:“使用中加密”启用时:

  • You can modify encrypted values.您可以修改加密的值。
  • You can insert documents and specified fields will be encrypted.您可以插入文档,指定的字段将被加密。

When In-Use Encryption is disabled:“使用中加密”禁用时:

  • You cannot modify encrypted values. Compass displays the values of these fields as a series of asterisks.您不能修改加密的值。Compass将这些字段的值显示为一系列星号。
  • Inserted documents can not encrypt fields.插入的文档无法加密字段。

Disable In-Use Encryption禁用使用中的加密

To disable In-Use Encryption:要禁用使用中的加密:

1

Click on In-Use Encryption on left-hand navigation bar.单击左侧导航栏上的“使用中的加密”。

In-Use Encryption Connection button
2

Click the Enable In-Use Encryption for this connection toggle.单击“为此连接启用使用中的加密”切换。

Disabling In-Use Encryption only affects how Compass accesses your data.禁用使用中的加密只会影响Compass访问数据的方式。