The encryption module is meant to facilitate simple AES encryption of values or files, which can this be stored on the server or database.

This module may be used by developers to encrypt values before saving to the database, and is used by the Student Files module to make sure files are stored in an encrypted state on the webserver.


After installing the module normally, visit the settings page, admin/config/encryption.

You may set up your key one of two ways:
#1) Just type in a key string (random characters), up to 255 characters. At least 100 chars are recommended.
#2) Enter the location of a key file on your server but outside of the web root.

Method #2 is the more secure way, since they key will never be stored in the database, but it does mean some extra overhead since every time you want to encrypt or decrypt a file or value, the key file must be read into memory.

Keep your key file a relatively small size. Ex: 100 - 300 random characters would be fine.


Whichever method you chose, the system will actually use a "hash" of your key, rather than the key itself. This is to ensure a uniform size as well as to add some extra entropy.

By default, the system will select the highest possible SHA hash in your system.

If you wish to enforce a particular hash protocol (ex: "md5"), then add this line to your settings.php file:

$GLOBALS["encryption_hash"] = "md5";

This will force that particular hash to be used.

Make note of which hash protocol you are using (see below).


Keep your key or key file SAFE. Anyone who gains knowledge of your key could decrypt your files or values. To protect against loss, it is recommended you print out your key on a sheet of paper, and then store it in a secure location. This way you can re-type it by hand if need be.

Be sure to also record which hash protocol was being used along with the key.

Core 5.x Releases

Version Download Postedsort descending
1.0-beta1 Package icon encryption-5.x-1.0-beta1.zip 09/19/2017 - 12:42 Release notes

Core 4.x Releases

Sorry, there are no 4.x releases at this time.