# Encrypting Data

Data encryption enhances the security of an application by securing content that may be considered sensitive data. For example, when building out an application that captures a social security number, this data can be considered sensitive and would need to be encrypted. Whether that data is a field within an app object or a variable created in an activity (web flow, web page, chat bot, voice bot), any of that data can be encrypted in the studio.&#x20;

### Encryption Keys

In order to encrypt/decrypt data, this requires an encryption key. There are two options when using encryption keys within Airkit, developers can either use the default keys that get created or bring your own encryption key. &#x20;

#### Default Keys

Every Airkit Organization get encryption keys automatically provisioned for each datastore (Development, QA, and Production). These keys are created using [AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html) and are provisioned with the default configuration.

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-47089fae37a97e98c24edea53def2d77c2d2ab86%2Fencrypting-data-v1715-0.png?alt=media)

#### Bring your own Keys

If the default key configuration does not meet security requirements, a [custom AWS KMS Key](https://aws.amazon.com/kms/features/#Custom_Key_Store) can be created outside of Airkit and be associated to a datastore.

To create a custom encryption key, go to [console.airkit.com](https://console.airkit.com) > Settings > Encryption Keys and select **Create new**.&#x20;

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-819955e480f69af6a5bb22521d83427dc7afb38d%2Fencrypting-data-v1715-1.png?alt=media) ![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-ef04f46c34bed1c360f25c8cbfed6ecf51efbcb2%2Fencrypting-data-v1715-2.png?alt=media)

Enter a name for the custom key and pass the Reference Key. The reference key is the Amazon Resource Name (ARN) of the KMS Key. To find the ARN see [here](https://docs.aws.amazon.com/kms/latest/developerguide/find-cmk-id-arn.html).&#x20;

### Encrypting Variables

Variables created in the studio can be encrypted to secure sensitive data. After encrypting a variable, the variable can still be read and set like normal across an application and within app preview - the only difference is that when it is stored in in Airkit's databases, the variables will be encrypted.&#x20;

To encrypt a variable, right click on the variable and select **Encrypt**.&#x20;

![organizing info](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-d3c89daaddf5b7eb0fc91ef4dd53c8c77e4c72c6%2Fencrypting-data-v1715-3.png?alt=media)

### Encrypting Fields in AirData

Fields in AirData can also be encrypted to secure sensitive content using the encryption key associated with the datastore. To associate an encryption key to a datastore, go to [console.airkit.com](https://console.airkit.com) > **Datastores** and select a datastore.  Then select the Encryption tab and an encryption key from the dropdown list.

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-023ca1bce0c03e9c8f435c90474acc36d9e34de7%2Fencrypting-data-v1715-4.png?alt=media)

To encrypt fields in an AirData App Object, go to Data Builder and select one of the fields of a created App Object. Then in the Inspector check the Encrypt flag to encrypt that field.&#x20;

![](https://1191388742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhOn9CLWoV9VfJeM5EDAa%2Fuploads%2Fgit-blob-ccc6b0aba8dfda54f8f37ff8ca64814bb8c2f0dd%2Fencrypting-data-v1715-5.gif?alt=media)

This will encrypt that field when the data is stored.

**Note:** There are limitations to data that is encrypted which include not being able to search or filter on that field.
