Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_setkey( <ckey> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_SETKEY( <cKey> )


Parameters

<cKey>
Encryption key. The key can be any combination of displayable or non-
displayable characters up to eight bytes long. Additional bytes are 
truncated.

Note  Encryption keys are case-sensitive.

Returns

NIL


Description

N_SETKEY() sets the encryption key used by NetLib's automatic 
encryption facility.

When a file is opened or created, NetLib will first check to see if an 
encryption key has been set with N_SETKEY(). If one has, NetLib will 
open or create the file using the current encryption key, and it can be 
used just as if it were not encrypted. Data is automatically decrypted 
for editing, display, or other manipulation, and automatically re-
encrypted when the file is written to.

If a file you are attempting to use was not encrypted with the current 
key, or if it is not an encrypted file, then the file will appear as 
"garbage" data.

NetLib preserves the encryption key associated with each open data 
file. Thus as soon as an encrypted file is opened, SETKEY can be 
changed again for the next file (see examples).


Examples

// Force user to enter correct encryption key
// before using files.
ACCEPT 'Please enter encryption key for MAIN.DBF: ' ;
   TO cKeyVal
N_SETKEY(cKeyVal)
USE main
ACCEPT 'Please enter encryption key for CUST.DBF: ' ;
   TO cKeyVal
N_SETKEY(cKeyVal)
USE cust
N_SETKEY()        // Disable key

// DBF and NDX are encrypted with different keys
N_SETKEY('key1')
USE main
N_SETKEY('key2')
SET INDEX TO main
N_SETKEY()        // Turn off



See Also: N_CODELVL()

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