Method CryptFile():encrypt() Professional

Encrypts a file.

:encrypt(<cSourceFile>, <cTargetFile>) --> lSuccess 
The file name of the source file.
The file name of the target file.

If encryption was succesfull, .T. is returned. Otherwise .F. is returned, and the error code can be retrieved by calling FError().


The method :encrypt() is used to encrypt a file. The target file includes a 32-byte header containing the file encryption type and version, the used file-i/o buffer length, the block size of the CryptProvider, and the size of the following data block. The header is not encrypted. The first data block is encrypted and contains the original file size, the key used for encryption in a hashed form, and the name of the source file. This information is used by :decrypt() to validate the correctness of the decryption.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.