Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to encrypt Visual FoxPro .dbf files


Microsoft Visual FoxPro can encrypt table (.dbf) ) files by building them into an encrypted .exe file. However, when the .exe file is run, the table files cannot be modified.

To work around this behavior, you can use several third-party products to encrypt FoxPro table files while allowing the data to be modified. You can also write a program to encrypt Visual FoxPro table files.

↑ Back to the top

More Information

Encryption prevents users from accessing .dbf files directly. It works by changing the file so it is not recognizable as a .dbf file. Visual FoxPro cannot use the .dbf file again until it is decrypted. Following are some of the ways you can encrypt .dbf files in Visual FoxPro.

Using Visual FoxPro to encrypt .dbfs

If a .dbf file does not need to be modified, you can add it to your project list and not mark it for exclusion. When you build an encrypted .exe file, the .dbf data will be included in it. You do not need to physically copy the .dbf file to the subdirectory where the .exe file will be found. When you run the .exe file, the .dbf information can be accessed, but it cannot be changed. Decryption of the .dbf file is automatic when the .exe file is run.

Beginning in Visual FoxPro 7.0, you can use the Crypt.vcx Visual FoxPro Foundation Class to encrypt data. The cryptapi class that is located in the ...\Ffc\_Crypt.vcx foundation class library provides access to the Windows Crypto API routines so you can encrypt strings, data, or files in your Visual FoxPro Applications. For more information on the _Crypt.vcx and the _crytapi class, see search the Help file for "_Crypt.vcx."

Third-party products to encrypt .dbf files

Communication Horizons

Xitech, Inc.
The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Writing a program to encrypt .dbf files

Many Visual FoxPro reference books contain sample code for different methods of encrypting and decrypting database files.

For examples, see these books:

"FoxPro 2.0 Power Tools," Malcolm C. Rubel, pages 938-942, Bantam Books, 1991, ISBN 0-553-35294-6

"Tom Rettig's FoxPro Handbook," Tom Rettig, pages 622-625, Bantam Books, 1990, ISBN 0-553-34937-6

"FoxPro 2.5 Advanced Developer's Handbook", Pat Adams and Jordan Powell, pages 222-228, Brady Publishing, 1993, ISBN 0-13-325341-4

↑ Back to the top

Keywords: kbvfpwrapup, kbvfp9applies, kb3rdparty, kbbillprodsweep, kb

↑ Back to the top

Article Info
Article ID : 115476
Revision : 3
Created on : 4/20/2018
Published on : 4/20/2018
Exists online : False
Views : 56