ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to encrypt whole image while saving

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Mar 25 2014 : 21:16:15
Hello,

I have to need to save ImageEn contents will all its layers intact to file.

Currently I am encrypting each layers using the encryption feature of ImageEn and then saving to file but this is taking very long at times especially when there are very large numbers of layes loaded with many large images.

In the same way it take a long time to load a file with multiple layers as we have to first load the file and then decrypt each layer.

I was wondering if there is a way to encrypt the contents at the time of saving to file. I think this will speed up the process.

Can someone help me here please?

TIA




Yogi Yang
5   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Apr 01 2014 : 21:18:36
quote:
I haven't used Lockbox for a long time, so you may be better off on the Stack Overflow forum for Lockbox queries.

Even though you have not used LockBox you solution worked! I spent one whole day trying to get the encrypted file back in ImageEN but without success.

It never occured to me that I should reset Stream Position to 0.

Thanks for this productive tip. :)

This solved my problem in a snap!



Yogi Yang
xequte Posted - Apr 01 2014 : 13:27:51
Hi Yogi

I haven't used Lockbox for a long time, so you may be better off on the Stack Overflow forum for Lockbox queries.

I can't see anything specifically wrong with your code, except that you probably need to reset the position of the streams before each method call.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Apr 01 2014 : 08:14:36
Hello Nigel,

I tried as per your suggestions and managed to save file properly but now I am not able to reload the file in ImageEN.

I have placed two components on Form - CryptographicLibrary1 and Codec1. I conneced both by setting Codec1's CryptoLibrary property to CryptographicLibrary1.

Here is the code to save file that seems to work:

var
fsPlain: TMemoryStream;
fsChiper: TFileStream;

...

Codec1.Reset;
Codec1.Password := '5961414C4C4148';

fsPlain := TMemoryStream.Create();
fsChiper := TFileStream.Create(SaveDialog1.FileName, fmCreate);

Child.ImageEnView1.LayersSaveToStream(fsPlain, -1);

Codec1.EncryptStream(fsPlain, fsChiper);

fsChiper.Free;
fsPlain.Free;


While the code to Load file is:

var
fsPlain: TMemoryStream;
fsChiper: TFileStream;

...

Codec1.Reset;
Codec1.Password := '5961414C4C4148';

fsPlain := TMemoryStream.Create();
fsChiper := TFileStream.Create(Name, fmOpenRead);

Codec1.DecryptStream(fsPlain, fsChiper);

Child.ImageEnView1.LayersLoadFromStream(fsPlain);

fsChiper.Free;
fsPlain.Free;


Please guide me here.

TIA

Yogi Yang


Yogi Yang
yogiyang Posted - Mar 30 2014 : 21:31:52
Thanks for the suggestion. I will look into this component.

Regards,




Yogi Yang
xequte Posted - Mar 27 2014 : 01:38:10
Hi Yogi

You would probably be better to save to a stream, encrypt the stream using a third party library (e.g. Lockbox) and save it to file.






Nigel
Xequte Software
www.xequte.com
nigel@xequte.com