# Encrypt Record IDs for Guest Users

For security reasons, don’t allow guest users to look up records by record ID unless you want the record to be public. When a guest user creates a record and wants to access it later, create an encrypted string that uses a combination of the record ID, record creation timestamp, and a current timestamp. The encrypted string acts as a unique identifier for the record that only the record creator has. At a later date, the Apex code that handles the request requires the guest user to submit the encrypted string. That Apex code decrypts the string to get the record ID and other record identifiers, and it retrieves or updates the requested record.

:::tip
The [User Encryption Decryption](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FYjU2UAL) AppExchange package provides the `UserCryptoHelper` class, which uses the `System.Crypto` Apex library for the encryption and decryption, stores the related data for you, and provides two template flows. Use the managed package to implement customized record ID encryption, or create a similar managed package of your own.
:::

**See Also**

- [Sample Code Without Sharing: Give Guest Users Access to Create Records and Read Them Later](/docs/platform/communities-dev/guide/communities-dev-sample-code-guest-users-create-read-later.md)
- [Sample Code Without Sharing: Give Guest Users Access to Create Records and Update Them Later](/docs/platform/communities-dev/guide/communities-dev-sample-code-guest-users-create-update-later.md)
- [*Apex Developer Guide*](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm)
- [*Apex Reference Guide*: Crypto Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_restful_crypto.htm)
