How to encrypt existing data in the database

PHPRunner and ASPRunner.NET Enterprise Edition can encrypt selected fields in your database. Once encryption is enabled, new or edited values in those fields are encrypted automatically.

If your database already contains data before encryption is enabled, the existing values need to be encrypted separately. This article explains how to encrypt those existing values.

Important: Before starting, make a backup of your database. Existing values should be encrypted only once. Running the procedure again may encrypt already encrypted data and make it unusable.

Run this procedure separately for each database table that contains fields you want to encrypt.

1. Add the encryption code

Add the following code to the List page: Before process event of the table.

PHPRunner
include_once("ciphcoding.php");
ASPRunner.NET
MVCFunctions.Ciphcoding();

2. Run the List page

Open the List page for that table and add the ciphcoding=1 parameter to the URL.

PHPRunner
https://website.com/project/mytable_list.php?ciphcoding=1
ASPRunner.NET
https://website.com/project/mytable/list/?ciphcoding=1

This processes the existing records in the table and encrypts the values in the fields configured for encryption.

3. Remove the temporary code

After the existing data has been encrypted:

  • Remove the code from the List page: Before process event.
  • For PHPRunner, delete ciphcoding.php from the generated application output.
  • Rebuild and upload the application again.

We recommend performing this procedure in a development environment or on a server that is not publicly accessible.

Applies to

  • PHPRunner Enterprise Edition
  • ASPRunner.NET Enterprise Edition

Back to top