---
schema_version: "1"
id: 15a61d4b65c30cee0224755e27f01e9b3ef3400064447ad297bce28707e50bf6
title: Use a Created Key with AMPscript
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_overview_use_a_created_key_with_ampscript.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_overview_use_a_created_key_with_ampscript.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ec9fced815fe7869df1a5d00c6d2725591901d4a2b986c6e56ee25a8e56cbe8d
description: Use AMPscript functions to encrypt and decrypt information stored in a custom data extension. The necessary AMPscript includes the EncryptSymmetric() and DecryptSymmetric() functions.
products:
  - Marketing
  - Marketing Cloud Engagement
release: "264"
---
# Use a Created Key with AMPscript

Use AMPscript functions to encrypt and decrypt information stored in a custom data extension. The necessary AMPscript includes the EncryptSymmetric() and DecryptSymmetric() functions.

1. Create the necessary keys.
2. Create the information in the data extension you wish to encrypt.
3. Include the AMPscript to perform the necessary encryption.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-mc_marketing_cloud_overview-264-0-0-production-enus/2555afdb-8049-4e3c-8043-0e04803e5f16/images/icon_example.png)

Example

This example encrypts the plain text value ExampleData using provided values and then decrypts that variable. The @null variable represents an undeclared variable.

```
%%[
SET @encData=EncryptSymmetric("ExampleData", "AES", @null, "password", @null, "0000000000000000", @null, "00000000000000000000000000000000")
SET @clearData=DecryptSymmetric(@encData, "AES", @null, "password", @null, "0000000000000000", @null, "00000000000000000000000000000000")
]%%
```

This example accomplishes the same task using external keys instead of provided values.

```
%%[
SET @encData=EncryptSymmetric("ExampleData", "AES", "passwordExternalKey", @null, "saltExternalKey", @null, "IVExternalKey", @null)
SET @clearData=DecryptSymmetric(@encData, "AES", "passwordExternalKey", @null, "saltExternalKey", @null, "IVExternalKey", @null)
]%%
```