> For the complete documentation index, see [llms.txt](https://docs.guardware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.guardware.com/documentation/protect/protection-scope/encrypt-by-data-type.md).

# Encrypt by Data Type

A [Data Type](/documentation/management-console/data-governance/data-type.md) defines the type of information GuardWare recognises as sensitive, such as personal details, financial data, or confidential business information.

PROTECT automatically encrypts files when their contents match a configured Data Type. Data Types identify sensitive information using:

* Sensitive Words
* Regular Expressions
* Filename Expressions

When a match is detected, PROTECT encrypts the file and applies the classification assigned to the Data Type.

You must [assign Security Groups to each Data Type](#assign-security-group-to-a-data-type) to control who can access or decrypt the files that match that Data Type.

### 1. Sensitive Words

GuardWare scans files for predefined sensitive keywords or phrases. If it detects a word or phrase, PROTECT automatically encrypts the file.

Example:

1. Data Type: Payroll Documents
2. Data Identifier: Sensitive Words
3. Phrases: PAYSTUB

In this example, if PROTECT finds the word PAYSTUB in any file, it encrypts the file automatically.

### 2. Regular Expressions

Regular expressions are used to detect structured data patterns such as credit card numbers or identification numbers. If PROTECT finds a matching pattern, it automatically encrypts the file.

Example:

1. Data Type: Card Number Regex
2. Data Identifier: Regular Expression
3. Expression: (?:\d\[ -]\*?){13,19}

In this example, if a file contains a number that matches this pattern, PROTECT encrypts it.

### 3. Filename Expressions

PROTECT can automatically encrypt files based on their folder paths or filename patterns. These expressions can include:

1. **Folder expression:** Encrypt files stored in a specific directory or path.
2. **File expression:** Encrypt files that match certain naming patterns, regardless of where they are saved.

When a user creates, moves, or saves a file that matches a defined Filename Expression, PROTECT applies encryption even if the file content does not contain sensitive words or detection patterns.

Examples:

1. Folder expression:

   ```
   *\Desktop*\Confidential*
   *\Desktop\Confidential*
   \\192.168.0.5\Public\PROTECT\Confidential*
   ```

   In this example, PROTECT automatically encrypts files stored in or moved to a folder path containing “Confidential”.
2. File expression:

   ```
   *_salary.xlsx
   ```

   In this example, PROTECT automatically encrypts any file ending with `_salary.xlsx`.

### Select Data Types

Select the Data Types that PROTECT should use to identify sensitive information. Only selected Data Types are available for Security Group assignment and automatic file protection.

1. Go to **PROTECT > Protection Scope > Active Data Types**.
2. Click **Add Data Types**.

   <figure><img src="https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FRXEPXkPv5jLsmWC3H3cw%2Fimage.png?alt=media&amp;token=9bfa5fba-810d-4ceb-bbdb-0063831ea61e" alt=""><figcaption></figcaption></figure>
3. In the available Data Types list, select the Data Types you want PROTECT to monitor and click **Add Selected Data Type**.

   ![](https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FckR1bdNJegypsNA8Bnc6%2Fimage.png?alt=media\&token=1c1ece1a-9573-40f5-b72d-e4a76f3672a2)

The selected Data Types appear in the list with the status **Enabled**. You can then assign one or more Security Groups to control access to files that match each Data Type.

### Assign Security Group to a Data Type

1. Go to **PROTECT > Protection Scope > Active Data Types**. You’ll see a list of Data Types, including predefined and custom Data Types.
2. Search for the Data Type you want to assign. Enable the Data Type from the **STATUS** column if it is disabled. You can assign Security Groups only after the Data Type is enabled.
3. Click **+Assign Security Group** in the **ACTIONS** column.

   <figure><img src="https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FLxg4pBmorkbAXIP3TpEe%2Fimage.png?alt=media&amp;token=d6fbdf32-7790-4153-95f8-d6f7dffdcb01" alt=""><figcaption></figcaption></figure>
4. Select the Security Groups you want to assign and click **Assign Security Group**. Only members of the assigned Security Groups can access the protected files.

   <figure><img src="https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FWsGNEPamA5Clg7LINtJF%2FUnknown%20image?alt=media&amp;token=6324f629-67cb-4ba4-b2ca-4f964eabbc87" alt=""><figcaption></figcaption></figure>

### Assign Data Type to a Security Group

1. Go to **PROTECT > Protection Scope > Active Data Types**. You’ll see a list of predefined Data Types.
2. Select the **Security Groups** tab.
3. Search for the Security Group and click **+Assign Data Types** in the **ACTIONS** column.

   <figure><img src="https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FVJ6YtHJ3MFSd9o5O0u32%2FAssign%20Data%20Type%20to%20Security%20Group.png?alt=media&amp;token=1c078f57-e00d-498d-9490-4acc70579c9d" alt=""><figcaption></figcaption></figure>
4. Select the Data Types you want to assign and click **Assign Data Types**. Only members of the assigned Security Groups can access the protected files.

   <figure><img src="https://2233655803-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi6thNYq9Il6WA2mTbj6X%2Fuploads%2FHTtkpAm62baAh640IhiE%2FUnknown%20image?alt=media&amp;token=2bd1f0e2-1c05-4e70-ab02-b1198e95331f" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.guardware.com/documentation/protect/protection-scope/encrypt-by-data-type.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
