Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Advantage CA-Clipper Guide v6.11 - ax_setpassword() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 AX_SetPassword()
 Sets the password for subsequent encryption/decryption
------------------------------------------------------------------------------

 Syntax

     AX_SetPassword( <cPassword>, [<lRunTimeError>] ) -> logical

     <cPassword>  A character string indicating the password to be
     used in all subsequent encryption/decryption operations. Only the
     first five characters in the string are used. This value is case-
     sensitive.  For example, a string encrypted with the password
     "BOGUS" would be different than if the password "bogus" were
     used.

     To clear the password, pass an empty string ("") as the
     parameter.

     Note:  Make sure to trim all trailing spaces from the password
     before passing it on to the AX_SetPassword() function, unless the
     spaces are intended to be part of the password.

     <lRunTimeError>  Optional logical value.  If .T., any error
     that occurs when setting the password will generate a run-time
     error.  If .F. (the default), any error that occurs when setting
     the password will not generate a run-time error, although .F.
     will be returned from this function.

 Returns

     Returns TRUE (.T.) if the password was successfully set,
     returns FALSE (.F.) if not. If .F. is returned, the error code
     returned from the AX_Error() function will give you more
     information as to why the operation failed.

 Description

     A single call to AX_SetPassword() should be made to initiate
     encryption and decryption in the current work area.

     After setting a password with AX_SetPassword(), all new records
     appended or updated in the current work area will be encrypted
     as they are stored. If all records in a table need to be encrypted,
     use AX_DBFEncrypt. To write a previously encrypted record in its
     decrypted form, use the following steps.
         1) Set the password to the correct value.
         2) Read the record.
         3) Clear the password by calling AX_SetPassword("").
         4) Update the record and write the data.

     After the password is set, any record read that was previously
     encrypted will be viewed in its unencrypted form. If AX_SetPassword()
     fails for any reason, any records that are encrypted will be treated
     as read- only.  If the entire table is encrypted, the entire table
     will be treated as read-only.

     Only one password can be used to encrypt records in a table.  When a
     password is set for the first time on a table, the table header is
     updated with the encryption information.  Subsequent requests to set
     a password on the table will only succeed if the correct password
     is supplied.  To remove encryption information from the table header,
     see AX_DBFDecrypt().

     For additional security, the security code is stored in memory
     in an encrypted form. Therefore, the password is not
     easily accessed at runtime.

 Example

     // Open TEST.DBF and set SECRET as the encryption password for this
     // table.  Then, encrypt TEST.DBF
     USE test VIA "DBFCDXAX" EXCLUSIVE
     AX_SetPassword( "SECRET" )

     ? "Encrypting TEST.DBF: "
     ?? iif( AX_DBFEncrypt(), "OK", "ERROR" )

     // Open TEST2.DBF and set BOGUS as the encryption password for this
     // work area.  Then, encrypt TEST2.DBF.
     USE test2 VIA "DBFNTXAX" NEW EXCLUSIVE
     AX_SetPassword( "BOGUS" )

     ? "Encrypting TEST2.DBF: "
     ?? iif( AX_DBFEncrypt(), "OK", "ERROR" )


See Also: SET PASSWORD USE

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson