sx_SetPassword

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_SetPassword

VB Declaration

Declare Sub sx_SetPassword Lib "Apollo9.dll"

(ByVal cpEncodeKey As Any)

Description

Defines an encoding key to be used in encrypting and decrypting data records in the current table.

Parameters

cpEncodeKey: A string used to encrypt the table. The maximum length of the key is 8 characters.

Once a password is set, all records written to the current table are encrypted using this key. Any encrypted records that are read will also use the key for decrypting.

Note: Memo data contained in DBT files cannot be encrypted since the .DBT format does not support binary data storage. FPT and SMT memo files are encrypted.

WARNING: The encoding key is not stored in the table in plain text. If you do not have the encoding key to the table, the data cannot be decrypted. If soliciting encoding keys from users ensure they fully understands the consequences of forgetting an encoding key.

If you wish to encrypt or decrypt all records in a table, set the key using sx_SetPassword and then call sx_DbfEncrypt or sx_DbfDecrypt.

Note: To turn off record level encrypting, pass this parameter as a NULL string (0&).

VB Example

' browse an encrypted database

Sub bRawDisplay_Click ()

RDbf = sx_Use(sDir + "sxcust.dbf", "cust", READWRITE, SDENTX)

If RDbf = 0 Then

MsgBox "Invalid dbf area"

Else

sx_SetPassword "HANDEL"

RNtx = sx_IndexOpen(sDir + "sxcust1.ntx")

sx_GoTop

End If

End Sub

See Also

sx_DbfDecrypt, sx_DbfEncrypt