Trying to stream images to Chrome and FireFox

Kakoroat
Kakoroat used Ask the Experts™
on
We have images that are encrypted on our LAN.  I've built a process to pull and decrypt the images.   I then have a web page that will display the images to the user who requested this.  All this works fine in IE 11 (I haven't tried Edge because we are still on Win 7).  Now people are asking for it to work in Chrome and FireFox, where it is not working.  The code that is streaming the image is this:

        Dim bt As Byte() = pfile.FileArray
        Response.ContentType = "image/tiff"
        Response.AppendHeader("Access-Control-Allow-Origin", "*")
        'Response.AppendHeader("access-control-allow-credentials", "true")
        Try
            Response.BinaryWrite(deen.DeCrypt(bt, BuildEncKey(LocalFC))) 'This is decrypting and streaming the file (again, works in IE 11)
        Catch
            Response.BinaryWrite(bt)
        End Try

Open in new window


On the page displaying the images, I tried hard coding a call in an image tag tag:

        <img id="tstimg" src="http://mysvr/pullfiles/pullfiles_encimg.aspx?kc=2573863&ekc=3c4c71f8e459d3ed2529c6a05b90956e&ob=028364&rand=20190604083928928" />

Open in new window


But this just shows a broken image in Chrome and Firefox.  My end goal will be setting the URL for the images through JavaScript

                myImg = new Image();
                myImg.src = res[idx].img1;  //A URL like the one in the above img tag
                myImg1 = new Image();
                if (res[idx].img2 != '')
                    myImg1.src = res[idx].img2;  //A URL like the one in the above img tag
                myImg2 = new Image();
                if (res[idx].img3 != '')
                    myImg2.src = res[idx].img3;  //A URL like the one in the above img tag

Open in new window


The above javascript is already in my code and it isn't working in Chrome or FireFox either.  So the ultimate question here is how do I stream the image from my server to Chrome and FireFox?  I really don't want to have to save the decrypted images locally (kind of defeats the purpose of encrypting the image if I end up having a decrypted version sitting on the server).
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi,

I would not use JavaScript for encryption, instead I would use PHP ....
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Aside: Along the lines of what lenamtl mentioned, using Javascript is like using a rock for a hammer. You can make it work + there are far better tools for this job.

In fact, you're entire process of what you call streaming encrypted images is overkill.

Just generate your images, using whatever criteria is required, then serve the images over HTTPS behind a login wall.

Login Wall: People can only see the images if they're authenticated during a login process.
Also anyone can take a print screen of the image (using a screen capture tool)..
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
lenamtl : I apologize if I was not clear.  I'm not using JavaScript for encryption.  The encryption is happening on the .Net server side.  The JavaScript is to change the src on the img tags.

David Favor:  When you say "Generate your images.."  The images already exist in the system.  The people are pulling them down to process them.  We are scanning postal mail (checks in particular) and then the images are used in processing and for sending Image Cash Letters (check 21) to the bank.  Also, when our customer service people are on the phone, they can see the checks and paperwork that was mailed in through a different web page.  I am trying to not have an unencrypted image sitting on our network.  I know I can't control the workstations having it and I'm relying on the people to clear their image caches (which they do several times a day for other reasons).
OK then a possible solution:
I would store the image in DB (blob) instead of encryption
this way your image won't be in a directory and no need to encrypt...
Commented:
Ok, after a slight shift in my searching I found the problem.  Chrome and Firefox don't support TIFF images and for the main purpose I have for the images, that's the format they need to be in.  

Thank you all for your suggestions.
Plus TIFF image are usually very big file, not suitable for the web...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial