[Tip] How to protect Image file

Hello,
If you have ever wanted to protect your image file,
especially within your Flash content,
this article will be helpful.
First of all, there are some points you need to protect when
you deliver image data with Flash.
1. Internet Browser Cache.
Even though you use 'HTTPS' protocol when you deliver your
file,
if it is pass the 'Network (or Protocol) Layer' of your
machine, it is already in 'plain' data
(not encrypted), and can be read by Internet Browser.
Those 'plain' data will be stored in Internet Browser's
Cache directory.
There are many Internet Browser Cache reader programs, and
they can intercept those
data before the Internet Browser program deletes the cache
files.
So, just using 'HTTPS' is not an answer. You need to encode
your image data
with your own (or with well known cypher algorithms)
encoding/decoding methods.
In this article, I want to explain more detail about this. I
scramble the image
so that make it hard to figure out what the original image
was, not only with human eyes
but also with 'strong enough' 'Key' length.
2. Screen Capture.
Even if you encoded your image data, it will be finally
shown on your screen,
without any noises, or any other ugly filters.
So, you can 'Capture' your monitor screen itself.
There can be many ways to avoid this. First, you can erase
the system's 'Clip board'.
You just can erase it regularly, or you can detect whether
the Internet Browser -which is
showing your image data- is active or not and erase clip
board when it is active (in foreground),
and hide your Flash area when the browser is inactive (in
background).
If a hacker just take a picture of monitor screen with high
quality Camera,
you still can avoid that, by showing some black rectangle,
or any layers on the screen
regularly only in very short period (like mili-second). But
I think this way sometimes you feel
tired or be annoyed when you watch that kind of blinking
screen.
== About my code ==
What I want to present here today is 'modifying(encoding) the
image' data itself.
There are many ways you can try for modifying your image data
and revert it back to original data.
You can use legacy block cipher algorithms like DES, AES, for
encoding and decoding the
image data, because the image data (RGB values) what Flash
uses is actually a combination of 'bit's.
But if you decode the 'encoded image' data, you probably use
'get pixel'/'set pixel' function for
reconstructing the proper 'RGB' value of each pixel. But I am
sorry that this function is extremely slow
so that you need to wait for a couple of minutes to see an
image.
So, what I want to show you today is 'Scrambling the image'
like 'picture puzzle',
with using 'copyPixels' function which is 'extremely fast'.
(Actually, there can be many other solutions for this, so
please don't hesitate to proceed your own research)
Let's say you have 8*8 pixel size of image blocks, and you
completely disorder those blocks for
entire image area. That size of block is too small to figure
out where it should be, with our
humble human being's naked eyes. So, you need to know the
'answer', which is saying what image block
was originally on which 'cell'. This 'answer' is the 'key'
for my simple 'image scramble' logic.
The 'key' I said here, you should understand that, is the
'key' value of normal 'block cipher' algorithms.
So, if you know the key, you can rearrange all those 'blocks'
back, but if you don't know the key,
simply you can't do that, or you need to wates tremendous
time for that.
Here, I use 16*16 size block for your eye's convenience, and
with 8*8 size of 'matrix' which is
comprised of each 16*16 size blocks. I mean, one 8*8 matrix
has 64 blocks, so each block of
one 'matrix' can be at '1st cell of matrix or 64th cell of
matrix. So, the 'odds' is 'Factorial of 64',
which is 64! == 1.268869322e+89 .
Let's say you know my algorithm (complete source code), and
you try every different 'matrix' values.
If it takes 0.001 seconds to test one 'matrix' value you have
chosen, it will take
"(64!) / (1000*60*60*24*365) =
4.0235582250724303685766549129617e+78" Years!!!! to find exact
matrix value.
== FLA sample ==
In my sample *.fla file, I embedded all those 'key' values.
So, you can not use my sample directly for your
own project. But I think this sample will give you an useful
idea for your own implementation.
<* Exchanging the key values *>
For example, you need to get the 'key' values from the
server, only when it is needed.
You can use 'loadVariables()' function for this purpose.
But, all data delivered by 'loadVariables()' or
'getUrl()', or any other functions of Flash, are
'Cached'.... So, you need to exchange that 'key' values
more safer way.
One of that 'safer key exchange' is to use 'token'. For
example, when the client requests the key value
to the server, the client should generate an random value (I
will call it 'token') and send it to the server.
Now the server modifies the 'key' value 'with the token',
and sends back to client. Finally, the client
decode the 'key' value with the token value it generated.
As you can see, my logic is just 'rearranging each blocks'
with respond to the given matrix values (key).
It is really really simple. There in the ActionScript code,
you can see 3 matrix, and some other variables.
var chessunit = 16 // Size of block
var arrayw = 8 // Width of Matrix
var arrayh = 8 // Height of Matrix
var arraysize = arrayh * arrayw
var chessarray = Array (arraysize) // Matrix for decoding
chessarray = Array
(64,37,5,35,45,25,52,38,12,61,34,23,3,26,39,58,32,28,17,2,60,16,59,19,57,48,43,18,47,21,4 0,15,31,6,44,46,30,51,27,56,20,24,13,7,42,1,49,54,36,53,9,50,4,8,10,14,33,11,22,63,55,29,4 1,62)
// In case of the width of an image is not exactly the
multiple of the width of matrix,
// we need to encode the right most area of the image.
// So, I simply use another matrix for only that area.
// Maybe You can generate more bigger image, of which the
width of it is exactly the multiple of
// the width of matrix. And you let the decoder to show only
the original size of the image.
// Please try yourself. :)
var dwArray = Array
(32,19,3,18,23,13,26,6,31,17,12,2,20,29,16,14,9,1,30,8,10,24,22,11,15,28,7,4,21,25,27,5)
// In case of the Height of an image is not exactly the
multiple of the Height of matrix,
// we need to encode the bottom most area of the image.
// So, I simply use another matrix for only that area.
// Maybe You can generate more bigger image, of which the
Height of it is exactly the multiple of
// the Height of matrix. And you let the decoder to show
only the original size of the image.
// Please try yourself. :)
var dhArray = Array
(40,23,4,22,29,16,33,24,8,38,21,15,2,17,37,20,18,11,1,10,12,36,30,27,13,25,28,14,19,32,35 ,7,5,26,3,31,34,6,9,39)
You can change the block size, matrix size, any values you
want.
By the way, if the block size becomes smaller, you'll get
more stronger security level. But you have to
compensate it with the slow down of the performance.
** Ooops, I can not attach my sample *.fla file, but only
ActionScript code here...
But I believe you can try without testing my *.fla sample.
If you really want to test it, please mail me.
([email protected])
** You need to 'export' image object, with the name of
"img0".
== Image encoder ==
Encoding (Scramble) the original image is also simple. You
just need to copy each blocks in reverse of
the 'ActionScript code'. That's all. You just use same
'matrix', but copy source and target reverse of
ActionScript code. I think you can write it with any
languages you like, C/C++, C#, Java, and
anything.... right?
== Block cipher ==
Now, you know that my implementation is kind of 'intuitive'
representation of 'block cipher'.
More precisely, it is called 'ECB', which encodes each
encoding block (matrix) with the key values
from the beginning to the end. You can twist the matrix every
time you pass one matrix area of an image.
It is called 'chaining'. There are some 'chaining' block
cipher methods like 'CBC'...
(If you want to know more, please look up "
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation
Thank you for your time to read my humble article,
and wish you Good luck. :)

Hello Crandom,
If you want to encrypt a critical strings, like special
server script url or parameters, then it is simple.
The most simple and faster method is to "XOR ing the string"
with a key string. You use the same key string when you encode and
decode (by Just using XOR). This is similar to 'Stream cipher'
algorithms.
And there is "open source cipher algorithm" (called
AS-CryptoLib) written in ActionScript, including most of algorithms
like Hash, Block cipher, RSA... if you want more stronger
encryption strength..
But I bet you also want to encode your script logic itself.
In that case, you should write your own 'Interpreter'. For example,
you encode all your ActionScript source code string, and decode it,
and you interpret each script tokens like 'if' 'for' 'while',
etc...
Actually, your question also inspired me to think about
loading script string and run it on the fly.
Maybe.... we can start from this article...
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16691"
I suggest you just use commercial SWF file encrypting tools
like Ameyata's "SWF encrypt". It changes the SWF file structure so
that usual 'SWF file decompilers' can not read codes properly.
And.... If you can use Flex2 (for your current project), and
it is ok with you (If you don't need to change a lot in your
current project) to use JavaScript to control your objects or
behavior of SWF file, then I think there is another possible way.
After you decode the Javascript string, you load a web page,
or change the content of HTML file already opened, so that your new
script will be working, as what you wanted to be. But I didn't test
it :)
Best regards.

Similar Messages

  • How to send image file through mail without   any attachment

    Plz tell  me how to send image file through mail without any attachment  ( i mean not converting  that image into pdf or any format )  i want to send that text or image  through mail .

    Hi Sandeep,
    I think you can setup the type of email in Shared office Settings in transaction S016.
    There is an option called <Preset document classes>
    You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
    http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
    Haven't tried it though.
    Regards,
    Siddhesh

  • How to store image files in oracle DB

    Hi,
    I am new to working with database.
    Please let me know how to store image files in Database using insert command.
    Thanks,
    Ramesh Yakkala.

    Hi,
    You need to create a directory object to import these files:
    Take a look on the example below:
    eg:
    CREATE TABLE MY_IMAGE_TABLE (
    ID NUMBER,
    NAME VARCHAR2(20),
    IMAGE BLOB);
    CREATE OR REPLACE DIRECTORY IMAGES AS '/tmp';
    GRANT READ, WRITE ON DIRECTORY IMAGES TO PUBLIC;
    CREATE OR REPLACE PROCEDURE load_file_to_my_table (p_file_name IN MY_IMAGE_TABLE.NAME%TYPE) AS
    v_bfile BFILE;
    v_blob BLOB;
    BEGIN
    INSERT INTO MY_IMAGE_TABLE (id, name, image)
    VALUES (1, p_file_name, empty_blob())
    RETURN doc INTO v_blob;
    v_bfile := BFILENAME('IMAGES', p_file_name);
    Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
    Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
    Dbms_Lob.Fileclose(v_bfile);
    COMMIT;
    END;
    SQL> execute load_file_to_my_table('myfhoto.jpg');Cheers

  • How to upload image files in sqlserver from jsp

    hi friends,
    i want to upload images to sqlserver how will i store url of the image or dorectly store the file in binary format, if we store in related path,plese give some ideas on store that paths in data base and how we store that image files in user directories.
    bye

    hi jay , I know that concept , but i dont know how to upload image files to server Please help me
    here i am giving my problem
    If any user register with site, he has the option to upload his image to the site, so i am using in html file upload option, But i dont know how to store that iamge into the server
    please give me suggestion
    regards
    sudhakar

  • How to save image files into SQL Server?

    Hello, All:
    Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!

    You need a BLOB field (usually)... Then you can check this tutorial out:
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
    There are other exercises on that site, including one on reading the images back.

  • How to add image file while creating addon...pathsetup?

    Hi friends,
    i have a problem while creating addon.
    while creating addon we can add all the files(.vb,xml).but if i add image files(.bmp,.jpg)they are not displayed in runtime.
    --how to add image file while creating addon..?
    we are useing SAP Business One 2005A(6.80.317)SP:01 PL:04

    Somebody knows like I can indicate to him to a button that I have in a form, that accedes to the image in the route where will settle addon? I have this, but it does not work to me
    oButton.Image = IO.Directory.GetParent(Application.StartupPath).ToString & "\CFL.BMP"

  • How to allow image file uploading, but protect the directory from abuse?

    I have an upload facility that allows visitors to upload their personal image (aka avatar) to my client’s site. This required me to CHMOD the assets folder to 777 which leaves the folder wide open to abuse.
    Is there a way to allow the uploading of files but protect the directory from abuse?
    I could put the images in the database but I assume that would quickly drag down the performance of the (MySQL) database.
    Any ideas?!
    Thank you in advance,
    Glenn.

    This required me to CHMOD the assets folder to 777 which leaves the folder wide open to abuse.
    Only if the abuser can get an executable file of some sort into that folder.  If you are filtering the files during upload to select only image files then I think you are pretty safe.
    I could put the images in the database but I assume that would quickly drag down the performance of the (MySQL) database.
    Definitely - you would never want to store the images as blobs unless you had a compelling reason to do so.  It's much more forward thinking to just save the image filenames in the database, and link to them as needed.

  • How to Check Images File Exist? in different server

    Hi,
    I have 10 different coldfusion server.
    for example 9 server is for the web application site - for
    example
    http://myserverone/studentweb
    the other one is for images website, just for displaying
    student picture - for example
    http://myserverimage/studentpicture.
    the purpose of this website is to display student picture
    that i store as gif files.
    from my studentweb website i will call the images from
    studentpicture website as source for my image placeholder.
    for example this is my code i'm calling form
    http://myserverone/studentweb
    website:
    <img src="
    http://myserverimage/studentpicture/#studentnumber#.gif"
    alt="" name="studentpicture" width="160" height="200">
    my problem is, if there is no specific student picture in my
    studentpicture website, then the placeholder will display an X (
    mean the images not found )
    how do i prevent the X to display?
    how do i using coldfusion or any kind of way to check if the
    images exist on that website ( different server ), so if the images
    is not found, i can display a default images? i can do this if i'm
    calling the website in the same server, but not using a different
    server.
    this is like using other website images for your own personal
    website and sometimes the owner delete the images from their
    website, and i want to display my own images if that images been
    removed from the source website.
    anyone have done this before?
    thanks for suggestion and guide...
    haire

    1. Use CFHTTP with method="HEAD".
    2. See, if the HTTP status code is 200.
    The head-method is of course more efficient, as it doesn't
    need to "get" the message body. However, a status code of 200 is
    possible even when the requested image file is no longer on the
    server.

  • IndesingCS2 server scriptable pluign: how to import image file into a frame.?

    Hello<br />I am creating a scriptable pluign for indesingcs2 server.<br />Now I am stuck at importing a image file in a image frame on a document.<br />The code which was running fine for indesingcs2 desktop is given below.<br />/////////////////////////////////////////////////////////////////////////////////////// ///////////<br />     IDFile sysFile = SDKUtilities::PMStringToSysFile(const_cast<PMString* >(&ImageFileNamewithcompletepath));     <br />     InterfacePtr<ICommand> importCmd(CmdUtils::CreateCommand(kImportAndLoadPlaceGunCmdBoss));<br />     if(!importCmd) <br />          return kFalse;          <br />InterfacePtr<IImportFileCmdData> importFileCmdData(importCmd, IID_IIMPORTFILECMDDATA); <br />     if(!importFileCmdData)<br />          return kFalse;<br /><br />     <br /><br />     //db is input.I got it using the techniques mentioned in the indesign-server-plugin-techniques.pdf<br />     //page 18..<br />     importFileCmdData->Set(db, sysFile, kMinimalUI);<br />     ErrorCode err = CmdUtils::ProcessCommand(importCmd);<br />     if(err != kSuccess) <br />          return kFalse;<br /><br />     InterfacePtr<IPlaceGun> placeGun(db, db->GetRootUID(), UseDefaultIID());<br />     if(!placeGun)<br />          return kFalse;<br /><br />     <br />     UIDRef placedItem(db, placeGun->GetItemUID());<br /><br />     InterfacePtr<ICommand> replaceCmd(CmdUtils::CreateCommand(kReplaceCmdBoss));<br />     if (replaceCmd == nil)<br />          return kFalse;<br /><br />     InterfacePtr<IReplaceCmdData>iRepData(replaceCmd, IID_IREPLACECMDDATA);<br />     if(!iRepData)<br />          return kFalse;<br />     <br />     iRepData->Set(db, imageBox.GetUID(), placedItem.GetUID(), kFalse);<br /><br />     ErrorCode status = CmdUtils::ProcessCommand(replaceCmd);<br />     if(status==kFailure)<br />          return kFalse;<br /><br />     return kTrue;<br />/////////////////////////////////////////////////////////////////////////////////////// //////////<br />I used the same code for making scriptable plugin for indesignCS2 server as it doesn't involve use of any UI element.<br />But this code is not working.It doesn't crash or returns kFalse.<br />What i see after executing the plugin through script is a grey region for image in the graphics frame.<br /><br />I request if anyone gives me solution to this i will be highly grateful to him.<br /><br />Thanks and Regards,<br />Yogesh Joshi

    Actually, your code is working fine, as there are no returned errors, asserts or crashes.
    The reason you are just seeing a gray box, is that the display performance is set to the lowest level in InDesign Server for performance reasons.
    Hint: Open the document in "desktop" InDesign, right click on the image, and look at the Display Performance settings for the image.
    See
    Ken Sadahiro, "[CS2 Server] Controlling display performance, how?" #1, 23 Feb 2006 8:01 am
    You can of course programmatically change it to the normal or high res settings from within your plug-in, but it might slow down the performance of InDesign Server a bit.
    One additional comment:
    In your code where you do this:
    importFileCmdData->Set(db, sysFile, kMinimalUI);
    I would do this, just to be safe:
    if (LocaleSetting::GetLocale().IsProductFS(kInDesignServerProductFS )) { importFileCmdData->Set(db, sysFile, kSuppressUI); } else { importFileCmdData->Set(db, sysFile, kMinimalUI); }

  • How to update image files in web pages generated by servlet without redeploying

    HI,
    I have a servlet which generates html pages with images. Those images changes
    as they are graph generated regularly. They are placed in s directory where the
    application is deployed. It is necessary because I have made some security constraints
    for the location of those files. However it seems that when I deploy my application
    on WLS all files contained in the application directory are cached, and when for
    ex. I delete some of them they are still appear in generated html pages. only
    Redeployment of application updates the state of those files.
    Is there a way to make the application to be aware of any changes in images files
    and to load updated ones??
    i would be interested in a situatioin like with default WLS servelt (DefaultWeb
    Application) where any new files are seen as soon as they are placed in Default
    WebApplication directory.
    Is there a way to periodically redeploy application from CLI?
    thx in advance
    Michal

    889096 wrote:
    Hello!
    In SQL Developer when we run htp package then we see the generated code in OWA Output, But how to invoke or show the webpage by Oracle tools/plsql program.
    and
    Without copying the code and save it to textfile.html and open it with browser.
    I heard it is possible by configuring Apache server.
    Please give me brief details, as i am beginner with ORACLE 10g
    And
    If you are using the htp package, you are presumably developing for an application server? Can the people who set that up not help you with your development environment?
    Setup is too complicated to cover here. Check out the Oracle HTTP Server documentation on oracle's documentation pages.
    Briefly, you need to install Oracle HTTP Server and then configure a data access desciptor to connect to your database.
    How to see the generated code in "QUEST TOAD"? I am not able to see OWA output in TOADYou will have to ask this question in a Toad forum.

  • How to put image files on fs directory instead of in DB?

    Hi,
    Currently I have logo image file (ie: logo.jpg) in DB. But I want to put it in file system directory for performance reason. So I
    1) put logo.jpg file in BOTH $ORALCE_HOME/apex/images AND $ORACLE_HOME/apex3.2/Apex3.2Download/apex/images (since I did an upgrade to 3.2 and unsure which ApEx location it's exactly).
    2) changed Shared Components -> Application Definition -> Logo -> FROM #WORKSPACE_IMAGES#logo.jpg TO /i/logo.jpg
    And yes, /i/ is defined as an image prefix.
    However, the logo does NOT show up.
    Any idea?
    Thanks much,
    Helen

    First, how are you accessing APEX? Via Embedded Gateway or HTTP Server?
    When put the logo file into the "images" directory, did you do this on the Database Server, or Application Server?
    - If Embedded Gateway, the only way that files are served is through the APEX interface, unless you explicitly path them from a different web server (same host is fine, but different port obviously). It's via Embedded Gateway in 11g db. Currently the image is loaded into database, but I want to change to filesystem.
    So I
    1) put logo.jpg file in BOTH $ORALCE_HOME/apex/images AND $ORACLE_HOME/apex3.2/Apex3.2Download/apex/images (since I did an upgrade to 3.2 and unsure which ApEx location it's exactly).
    2) changed Shared Components -> Application Definition -> Logo -> FROM #WORKSPACE_IMAGES#logo.jpg TO /i/logo.jpg
    And yes, /i/ is defined as an image prefix.
    However, the logo does NOT show up.
    Any suggestions/ideas?
    Thanks,
    Helen

  • How to include image file in ard

    Dear members,
    I have to include one more menu next to reports menu in sap B1. I need to include the picture symbol.
    Can anybody inform me how to include the image file while making the add-on.Normally we include the exe file and dll files.Is there any specific methods to include the image.Please kindly let me know.
    Regards,
    Venkatesh.R

    in srf attached image button.
    and write code
    Dim img As SAPbouiCOM.PictureBox
                    img = oForm.Items.Item("14").Specific
                    SPath = CurDir() '.Remove(Len(CurDir) - 3, 3)
                    img.Picture = (spath & "\Avijit.bmp")
    Spath is nothing butthe location where u put all files .
    regards,
    Avijit

  • How to Insert image file from fileChooser to a tabbedPane?

    Hi,
    Currently, i have encounted a problem halfway through my project. That is how do i insert images into a tabbedPane after selecting a image file from the fileChooser?
    Do anyone has any idea of how to solve the above problem?
    Thanks!!

    I would put the image in a JLabel and put the JLabel in the tabbed pane.

  • How to display image file from the link in the field

    Hi all,
    I have a column where it keeps the link of the image files reside. The link will be in the server such as \\server\picture1.jpg
    I have try to code in Read_Image_File('\\server\picture1.jpg', 'ANY','OM_ITEM.ITEM_URL');
    But I was encountered error run, ORA-01465: invalid hex number.
    Any one please help me. Thanks.
    Regards,
    Lim

    There are tons of informations missing here, for instance (but not limited to) the exact forms version you are using (note: 10g is not a version, but 10.1.2.0.2 is). Without Version informations a correct answer is not possible
    You might want to go through the links from the Announcement entitled "<a href=http://forums.oracle.com/forums/ann.jspa?annID=432>Before posting on this forum please read </a>" which contains links to the documentation and instructions on how to post proper questions for example.
    cheers

  • How to read image file in bpel..

    i want to pick up image files of format .jpg & .png in bpel..
    Thanks...

    Hi,
    Ok, got your flow. I'd recommend start small and simple.
    Receive
    Assign
    Invoke - Invoke File adapter using Synchronous Read Operation (Normal Read operation will not work in the middle of process) with Opaque schema and by specifying the exact file name.
    I think you can't specify the file name as regular expression in Sync Read operation.
    Also follow the below link for more details on how to achieve your requirement.
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#BABGHDHG
    Regards,
    Neeraj Sehgal

Maybe you are looking for

  • External Display Woes

    I recently purchased a 20" Cinema Display for use with my Macbook. Everything works fine, powered right up using a mini dvi to dvi adapter, resolution is great. I purchased this after going through a couple Dell monitors at Best Buy and returning the

  • How to detect the two Enter in  HTTP Request Line"

    I'm writing a HTTP Server. I want to ask how can I detect the "two <Enter> press" when the client finishes his request. Suppose the client typed the following: GET /xxx/index.html<ENTER> <ENTER> (Response header and Entity body here) if the user type

  • Push buttons are not triggering on the selection screen

    selection-screen begin of block a with frame title text-001. selection-screen skip. parameters:z like vbap-vbeln. selection-screen skip. selection-screen begin of block b with frame title text-002. selection-screen skip. parameters:sales radiobutton 

  • Cannot play more than one music video at a time

    I would really like to setup my ATV to play multiple consecutive music videos either randomly or in a predetermined order. But I cannot seem to get this right. I can only play one video, then it returns to the menu for me to select another. Any help

  • ATTACH DOCUMENT TO ABAP OBJECT

    Hello All, I have a situation here. i need to attach a document to the business object(customer number) . am not sure what all the function modules or methods i need to use.Could any one please shed some light here as am new to this. and also what al