You are currently offline, waiting for your internet to reconnect

How to encrypt Visual FoxPro .dbf files

This article was previously published under Q115476
Microsoft Visual FoxPro can encrypt table (.dbf) ) files by building them into an encrypted .exefile. However, when the .exe file is run, the table files cannot bemodified.

To work around this behavior, you can use several third-party products toencrypt FoxPro table files while allowing the data to be modified. Youcan also write a program to encrypt Visual FoxPro table files.
Encryption prevents users from accessing .dbf files directly. It works bychanging the file so it is not recognizable as a .dbf file. Visual FoxPro cannotuse the .dbf file again until it is decrypted. Following are some ofthe 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 yourproject 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 tophysically copy the .dbf file to the subdirectory where the .exe file willbe found. When you run the .exe file, the .dbf information can beaccessed, but it cannot be changed. Decryption of the .dbf file is automaticwhen 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 ofencrypting 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
VFoxWin FoxDos FoxWin encrypt hide

Article ID: 115476 - Last Review: 02/12/2007 18:25:26 - Revision: 3.4

Microsoft Visual FoxPro 3.0 Standard Edition, Microsoft Visual FoxPro 6.0 Professional Edition, Microsoft Visual FoxPro 7.0 Professional Edition, Microsoft Visual FoxPro 8.0 Professional Edition, Microsoft Visual FoxPro 9.0 Professional Edition

  • kb3rdparty KB115476