Protecting Application resources

I am including a text file in Resources:Scripts:secretTextFile.sql

Although I know you can make scripts and applications read-only, how can I protect a text file within the Application?


encrypt it for example with one of the encryption methods in openssl

Hi Stefan,

I have to be able to call the sql file with something like this:

tell application "Terminal"
	if not (exists window 1) then reopen
	do script "sqlite3 " & databasePath & " < " & textFile in window 1
	delay 1
	do script "logout" in window 1
end tell

The reason I’m using terminal is because

do shell script "sqlite3 " & databasePath & " < " & textFile


do shell script ("sqlite3 " & databasePath & " \".read " & textFile & "\"")

both seem to terminate before the commands are done executing.

I have used openssl like this before:

Encrypt the file:
openssl des3 -salt -in file.txt -out encryptedfile.txt

Decrypt the file:
openssl des3 -d -salt -in encryptedfile.txt -out normalfile.txt

What is the best way of working it into this workflow?

I don’t know whether sqlite can read the database only from a file or from stdin too.
Maybe you could use a temporary file to encrypt/decrypt the data.

So decrypt file, import, delete?

Any idea why shell instance is terminating before sqlite is done processing input? Any ideas about a workaround? I would rather not call terminal.