Posted by trezbo in SWF Studio V3 on Feb 27 2008, 11:00 am

Hello,
I am only new to SS as i have just switched from zinc. I am running into a problem tho to do with the Cryto. Is it possible to use the same source and destination file? I am trying to load in a txt file, Encrypt it and then save that file...
This was the mdm function which worked fine...
//mdm.Encryption.encryptFile(mkey,inputFile,outputFile);

But when i try this with SS it seems to delete the txt file i create..
inputFile = _root.thePath+theFile+"_m"+_root.thisMode+".txt";
outputFile = _root.thePath+theFile+"_mo"+_root.thisMode+".txt";

ssCore.Crypto.encryptFile({source:inputFile, destination:outputFile, key:mkey});


Any help is appreciated!

Trezbo


Posted by northcode in SWF Studio V3 on Feb 27 2008, 11:10 am

The first thing that encryptFile and decryptFile do is delete the destination file. We do this so we know if there's going to be a problem writing the destination file. It saves doing the crypto operation if the file is read only, on a CD, etc. Unfortunately that means that, in your case, the input file is deleted before it is loaded.

One fix I could make is to skip the initial delete test if the input file and output file are the same.


Posted by trezbo in SWF Studio V3 on Feb 27 2008, 11:25 am

Is that possible using actionscript?


Posted by northcode in SWF Studio V3 on Feb 27 2008, 11:28 am

No, it requires a change to SWF Studio. But I just made the fix and it works so it will be available in the next build of V3.5 that we release.

Do you mind if I ask what made you decide to move away from Zinc?


Posted by AGo in SWF Studio V3 on Mar 01 2008, 08:43 am

However what you can do now is to either copy or rename your source file via the ssCore.FileSys methods, and then use that modified file for your encryption. You don't have to wait for Tim's modifications this way ;)