hub.eb?material_id=417&track_id=414

Encryption Services


The services.encryption interface contains functions used to encrypt, decrypt and hash data.

The available functions include:

  • encryptAES()
  • decryptAES()
  • generateHash()

A common use for this interface is to hash passwords, preferably using a salt unique to each user, for secure storage in a database.

Steps


1

Create a new form and add a Field, myField, with the Character Field type and the Password Display type. Add a second Field, myEncryptedField, with the Character Field type and the Text Display Type. Drag both field onto the page to create Field Controls.

2

Add a Button Control with the text Encrypt. Give the button an On Click event with the following code:

// Encrypt the value of myField
var encrypted = services.encryption.encryptAES(fields.myField.value);

// Display the value in myEncryptedField
fields.myEncryptedField.value = encrypted;
3

Run the form, type something into the myField Field Control then click the button. The myEncryptedField Field Control will display the encrypted form of the value you entered.

Current Module

Related