Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encryption questions
Message
From
08/01/2008 12:39:59
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01276712
Message ID:
01280254
Views:
32
Hi Cristof,


Thanks for the response.

More information on the fll I am looking at can be found at: sweetpotatosoftware.com/spsblog by searching on vfpencryption. I will paste some of this below here:


In any case, it seems I need to generate a character key of sufficient length to utilize these functions and retain the key for use when decrypting again. I believe that the returned value of most of these does not match the length of the string to be encrypted, as I agree that makes them much less secure. However, I'd need a practical limit so I know how to size the field storing the encrypted text.

Say I have a field C(20) to be encrypted, how do I know how big to make the column to store it?
Function ENCRYPT()

Signature: Encrypt(cStringtoEncrypt, cSecretKey[, nEncryptionType[, nEncryptionMode]])

Parameters:

cStringtoEncrypt - A plain text string that you want to have encrypted, such as "Hello World!"

cSecretKey - A plain text string that is the Key you want used during encryption, such as "My_SeCrEt_KeY".
Please note that keys may need to be of a particular length for certain types of encryption. Refer below for more information.

nEncryptionType - There are currently 5 types of encryption available. The value of this parameter determines that type of encryption used and how long your Secret Key should be. A single character in Visual FoxPro is  equal to 1 byte or 8 bits. So an encryption algorithm requiring a 128-bit key would need a Secret Key of 16 characters (16 x 8 = 128).

   0 = AES128 (requires a 16 character Key)
   1 = AES192 (requires a 24 character Key)
   2 = AES256 (requires a 32 character Key) *Default
   4 = Blowfish (requires a 56 character Key)
   8 = TEA (requires a 16 character Key)
   1024 = RC4 (Key can be any length)

nEncryptionMode - There are three different modes available for the each of the encryption types listed above. They include: Electronic Code Book (ECB), Cipher Block Chaining (CBC) and Cipher Feedback Block (CFB). The nEncryptionMode parameter does not apply to RC4 encryption (nEncryptionType = 1024).

   0 = ECB *Default
   1 = CBC
   2 = CFB

Return Value:

Character data type - the encrypted form of cStringtoEncrypt.

Remarks:

When saving the return value of Encrypt() function to a field in a table, remember that Visual FoxPro will append blanks to the end of the string in order to fill the character field to its designated length. This can cause problems when decrypting the data as the spaces will be considered part of the encrypted string. To work around this, I suggest placing a single CHR(0) at the end of the encrypted string when saving it to the table. Then when decrypting the data just the portion prior to the CHR(0) can be sent into the Decrypt() function. This does not apply when using RC4 encryption (nEncryptionType = 1024).
Jim Newsom
IT Director, ICG Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform