Secure Stacks

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

Secure Stacks

Post by SirWobbyTheFirst » Mon Oct 12, 2009 9:58 pm

In each of my stacks is a customPropertySet called FileHeader which tells the software who's the developer, the file version, copyright and any other details.

As part of the softwares security the FileHeader has a property called cSignature which contains a compressed form of the developer name, file version and copyright as well as the file description which is matched up against the values returned by the FileHeader set.

I was wondering if there was any way for my software to tell if a stack had been modified. I tried a question about the MD5Digest function but i needed that to be able to store the value in the cSignature property however the result will always change each time the stack is saved so keeping the MD5Digest value up to date would be like trying to create your own universe. In a nut shell impossible.

So if anyone code help me. Cos i am completely baffled. If any more details are needed let me know. Thanks everyone.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Tue Oct 13, 2009 2:09 pm

I'm not sure if this is any solution to your particular problem, but you can store stuff in scripts, and those are encrypted with the build in password stuff (unlike custom properties). However you can only set a script to less then 10 functional lines. But if you do not want to actually execute anything, you can add comments to an empty or existing less-then-eleven-lines script, and that will be encrypted (tho the encryption used is rather weak pre-rev 4.0).

Code: Select all

set the script of button "versioning" to "--cversion: 2" & return & "--csignature: a3e45ffb"
set the password of this stack to "blah"
save

Code: Select all

go stack "~/versioning.rev"
set the passKey of stack "version information" to "blah"
put the script of button "versioining" into theInformation
split theInformation by return and ":"
put theInformation["--cversion"]
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Tue Oct 13, 2009 2:20 pm

Ah right, as for knowing if a stack is "dirty" (changed), there's a way to do that, namely change some cprop in every script of your stack to "true".

Code: Select all

if the dirty of this stack then put "i was changed"
Of course that's error prone and can lead to wrong results if you over do it. For example the rev ide uses mouseUp in a frontscript, so whenever you click anywhere in a stack (but not an editable field), the stack is flagged as changed by the ide.

If you want to use md5digest, you can do that, if you store the md5digest in another stack/file, or just remove it before making the comparision:

Code: Select all

--appending
save
put the md5digest of url ("binfile:" & "stack.rev") into theDigest
go stack "stack.rev"
set the md5dig of this stack to theDigest
--extracting
put the md5Dig of this stack into theDigest
set the md5Dig of this stack to ""
save this stack
put the md5digest of url ("binfile:" & "stack.rev") into theCompareDigest
put theDigest = theCompareDigest --false = changed
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply