Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently November 2nd, 2024, 9:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: File Encryption Using Scripting
PostPosted: April 25th, 2007, 1:27 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I'm been working on a pub designed to collect health sensitive data and therefore needed to create the most secure storage possible for a text file used to store the data. Scripting is used for storage to a text file, and the file is encrypted by adding "true", and an encryption key, for write and read functions.

The problem, discovered by accident, is that for reading back from the text file, it doesn't seem to matter if the correct encryption key is used or not. Seems that any key will do. The resulting storage file still appears encrypted. I wonder if what is happening is that Opus is applying a default encryption (similar to what I believe happens when using the standard Opus 'store to text' file action when the encryption box is checked and no specific key is entered). Here, using scripting, and using a specific encryption key, something similar seems to occur.

Because of the yet experimental nature of the pub in question, it's not possible to post it for viewing. However, Forum colleagues or the DW team wishing to check this can create a basic, scripted 'store to' and 'read from' text file, placing a specific encryption key in the script and trying to read it , using a different key. I tried to create such a sample from scratch and every time I previewed, it froze and needed the task manager to extricate from the frozen screen. Sorry.

I will be interested in any feedback from those finding a similar problem.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 17th, 2007, 11:30 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi

I have continued to try to get the encryption to work in a project, when using scripting to set the encryption key, without success. I was hopeful that the new Version 6 would solve the problem, but unfortunately it remains.

The encryption fails when using scripting and writing to or reading from a text file. Standard Opus file saving actions that add encryption seem to work. Just not when scripted.

My guess is that when using scripting to set encryption both Pro XE 5.5 and V6 fail to set the specific encryption key specified in the script and, instead, set a default Opus encryption key (similar to what would occur using the standard Opus action and not specifying a key--see help guide about default encryption keys in this instance).

I have created a small .imp sample file and attached it so others can test this, suggest any remedies. The sample file saves using the encryption key "abc" and reads using "xyz." Unfortunately, it seems to read fine indicating that any key (or no key?) will do.

Any help would be appreciated. It's difficult to create privacy of data when depending on a generic default encryption key that any copy of the pub would thereby have to open text files.

Kind Regards,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 18th, 2007, 12:39 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 511
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Stephen,
I've never used encryption, but I gave it a try.
When I have a problem like this I always reduce it to the simplest form possible--I can't think of too many things at once!!
I reduced your demo to a single script which seems to work??

Code:
var textObj = OpenFile(SYSTEM_DOCUMENTS_DIR + "\\" + "aaaa.txt", false)
textObj.WriteLine("Sandy", true, true, "abc")
textObj.Close()

Debug.trace("written"+"\n")

var textObj = OpenFile(SYSTEM_DOCUMENTS_DIR + "\\" + "aaaa.txt", false)
var MyText=textObj.ReadLine( true,true, "abc")

Debug.trace(MyText)




If the read key is abc, it retrieves Sandy, if it's changed to xyz, it returns the encrypted word.

as far as I can see the basic function works as I would expect it to. I also looked into the file and it's always encrypted.
I changed the script a bit from what you had.
So, seems to work, or am I missing something??(it's late here)

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 18th, 2007, 3:44 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Sandy

Thank you for your reply.

While I have no doubt that the substituted script will work as you've suggested, I'm afraid when it comes to the original script inside of the attached sample .imp, extending these same changes to it does not seem to get it to encrypt and work.

The pub requires saving a lot of data like positions, so I created the sample .imp and script with a couple of PosX and PosY variables in order to replicate the type of encryption task needed. The solution would need to work firstly with display data, plus text selection and other data types as well.

Since I have limited skill with scripting, perhaps, I'm still doing something wrong. I'm unsure why I can't get the encryption to work when writing position variables to a text file using a script.

Any ideas would be welcome.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 18th, 2007, 7:03 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 511
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
I have applied very quick mods to your pub and it seems to work, but I still may be misunderstanding the problem.

remember ReadLine reads the first line, so you have to delete your text file before each run to test it. You will have to add control to retrieve the correct line if you run this more than once.
If both keys are abc, the second screen shows the position, if the keys are different, it shows garbage, (but not in your variables PosX,PosY because you are simply displaying the pub variable).

all I did was concatenate the ball position into a string and stored it in a variable, then passed the variable through the file encryption. You would then have to split the retrieved variable to get PosX and PosY , but that's just standard String scripts.


You do not have the required permissions to view the files attached to this post.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: May 18th, 2007, 9:29 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Stephen,

The encryption works fine, it just appears that a different key is decrypting the file because of the way you have set upi your publication. Although, you are reading the ciphered text back in from the file, the variables you displayed on screen are NOT from deciphered values but the unencrypted values from the previous page. You can easily test this by simply running page two.

There are a couple of changes to make to ensure that it works, most importantly:

You need one writeline per variable! (you can use writefield to get everything on the same line in the file, but you still need one per variable)

You MUST specify, in the writeline command, whether quotation marks are true or false as this CANNOT be left BLANK.

Mack

P.S I think that encryption via scripts classifies as an advanced topic :-)


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 18th, 2007, 2:46 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thanks for your suggestions. :)

The "trick" here was to add the true or false for quote in the write to/read from scripts. Left blank, it seemed to cause the encryption to fail. Once filled in, it worked.

Kind Regards,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group