Creates an encrypted copy
of the file named by
Opens the encrypted file using the given integer key and returns a FileStream value that you can then do read calls on, exactly as you can on FileStreams returned from the openFile() function.
encryptFile() and openEncryptedFile() let you encrypt a text file with your own key and open an encrypted file via a key for reading. Among other things, you can use this to write and read an encrypted file containing a hardware lock ID for doing authorization-based piracy protection.
Here is some code that creates an encrypted lock ID file in some authorization process.
f = createFile "lock.tmp"
format "%" hardwareLockID to:f
encryptFile "lock.tmp" "lock.dat" 5476557
The following code can be used to read and check the lock ID (obviously, all this is only safe if the creation and checking scripts are themselves encrypted):
f = openEncryptedFile "lock.dat" 5476557
id = readValue f
if id != hardwareLockID then
message "Lock ID's don't match"