emFile Add On – Encryption

The Encryption add-on provides an easy way to secure the data of individual files or the data of a storage device as a whole. Encryption can be used with both available file systems (EFS and FAT) and with all supported storage device types such as NAND, NOR, and SD / MMC cards.

To use encryption, only minor changes to the application program are required. The rest of the application program works in the same way as without encryption.

Encryption and decryption is performed in the software at high speed. If hardware encryption is supported on the particular target, the file system can easily take advantage of this to increase the performance.

Key features

  • Can be used with both FAT and EFS file systems
  • All storage device types such as NAND, NOR, SD/MMC cards are supported
  • Minimal changes of the application are required
  • DES and AES with 128-bit and 256-bit key lengths supported
  • Supports encryption of entire media or of individual files
  • Comes with PC utility to decrypt/encrypt files

Editions

emFile Encryption is available in two different editions.

EncryptionExtra Strong Encryption
DESYesYes
AES 128-bitNoYes
AES 256-bitNoYes

How to use encryption

Encryption on target side

Using file encryption is very simple from the perspective of the user. The following steps have to be performed to enable encryption in your application:

  • Enable file encryption in the emFile configuration by setting FS_SUPPORT_ENCRYPTION define to 1.
  • Call FS_CRYPT_Prepare() to initialize an encryption object. This operation has to be performed only once.
  • Open a file and call FS_SetEncryptionObject() to assign the encryption object to that file handle.

These are the only changes required to be performed in the application. Everything else is done by the Encryption add-on.

The following sample function opens a file and writes a text message to it. The file contents is encrypted using the DES encryption algorithm.

Encryption Target Side

Decryption on PC side

The file encrypted on the target system can be decrypted on a PC using the File Encrypter command line tool. The following screenshot shows the messages printed out by utily while decrypting the contents of the des.bin file. The decripted contents is stored to des.txt file. In this case the encryption algorithm used is DES as specified unsing the -a option. The File Encrypter utility shows information about the progress of the decrypting process. In case of an error, a message is displayed and the utility returns with a status of 1 and the file is not decrypted.

Decryption PC Side

Performance

These performance measurements are in no way complete, but they give an approximation of the length of time required for common operations on various targets.

Target DeviceCPU speedStorage deviceWrite speedRead speed
NXP Kinetis K60120 MHzNAND flash interfaced via 8-bit bus using AES with an 128-bit key.522 Kbytes/sec553 Kbytes/sec
ST STM32F496 MHzSD card as storage medium using AES with an 128-bit key500 Kbytes/sec530 Kbytes/sec