The functions within this FLL have changed. Please refer to the latest
documention for the VFP Encryption FLL that can be found at the
following link:

Major VFP Encryption Update

As security concerns mount, developers and clients are looking at ways to encrypt/decrypt sensitive data and files. Visual FoxPro comes with a Crypto API example in the Solution Samples, but more than a few Visual FoxPro developers have been bitten when using this in distributed applications. I felt there were too many gotchas and, after running into my fair share of client systems that it didn’t work on, I eventually gave up on it.

What I wanted was something extremely secure and reliable that was also very simple to use. So, I sat down and wrote an FLL that gives Visual FoxPro developers access to the Blowfish cipher (this is not a mini version of Blowfish, this is fullblown 16-Round based on work by Bruce Schneier & Jim Conge). Some good information is available at the links below for those of you that might not be familiar with Blowfish…

16-round Blowfish is very secure, extremely fast when handling large amounts of data, and I like the idea of only having to write a few lines of code to get reliable encryption and decryption for my Visual FoxPro applications.

   SET LIBRARY TO LOCFILE(“vfpencryption.fll”)
   cEncryptedString = BFEncrypt(“Credit Card #35823908523105009”, “My_SeCuRe_PaSsWoRd_kEY”)
   ? “Encrypted As: ” + cEncryptedString
   cDecryptedString = BFDecrypt(cEncryptedString, “My_SeCuRe_PaSsWoRd_kEY”)
   ? “Decrypted As: ” + cDecryptedString

Files can also be encrypted, simply use STRTOFILE() and FILETOSTR() in conjunction with the above functions. I’ll be adding native file encryption/decryption and more encryption algorithms to this FLL in the coming months. The eventual goal is to provide a number of security enhancements for Visual FoxPro, this FLL is just the humble beginning of a much bigger plan. Here’s the download link where you can get the vfpencryption.fll and try out the example code above.

Download the vfpencryption.fll (9 KB approx.)