471,895 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,895 software developers and data experts.

Reading encrypted files in Java Script.

Hi All,
I want to store data in a encypted form (in form of some file) and later on i want to read encrypted data in Java Script and want to pass that encrypted buffer to some Active X component.

My first question how should i read/load a file in java Script and read its contents.?
Also is it possible to parse data in javascript?

Jan 29 '09 #1
10 2945
8,658 Expert Mod 8TB
if the file is on the client's machine you're out of luck (Javascript isn't allowed file system access). to access a file on the server you can use AJAX. but if you do server side stuff, maybe you don't need Javascript at all for ActiveX (besides the fact that ActiveX only works in IE).

Jan 29 '09 #2
Thanks for your response.
Yeah my encrypted file resides on server, that means i have to use AJAX for reading contents of that file.

Actually my purpose is to send encrypted Data to ActiceX functions. So other possibility i am thinking that i can access encrypted file contents directly in ActiveX. So in order to achieve this i have to get the Web Page URLin ActiceX and through that URL i can get the path where file is present and after that i can access the contents of that file directly in ActiveX.

Can this is possible in ActiveX?

Jan 30 '09 #3
8,658 Expert Mod 8TB
unfortunately I can't tell you, because
  • I don't have IE
  • ActiveX is not supported by browsers other than IE (so you'd exclude quite a lot of people)
  • in my opinion, IE is the worst browser available
Jan 30 '09 #4
16,027 Expert Mod 8TB
What exactly are you trying to do here (by reading encrypted files with ActiveX)?

If it resides on the server, let the server-side code decrypt it and then allow a download which you can use in any program on the client.
Jan 30 '09 #5
Yeah i know i can use server side scripting in order to push the content on client side, but i dont want to use any server scripting language on server side.

Is there are any API's/Functions in ActiveX which downloads the file residing on server by opening some http steams etc.

Jan 30 '09 #6
16,027 Expert Mod 8TB
It probably is possible, but you'll need to give permissions and it should be used sparingly and with caution. Check the documentation on the MSDN website.
Jan 30 '09 #7
Thanks for all your response.
i Have one more question regarding Ajax. I want to read binary file in JavaScript.

I have code the following lines.

Expand|Select|Wrap|Line Numbers
  1.     var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
  3.     xmlHttp.onreadystatechange = function() { 
  4.         if (xmlHttp.readyState == 4) { 
  5.     result = xmlHttp.responseStream;
  6.     alert(result);
  7.         } 
  8.     }
But this is not working. Can u tell what is problem in above code.

Jan 30 '09 #8
8,658 Expert Mod 8TB
the official docs (http://www.w3.org/TR/XMLHttpRequest/) do not mention this property (responseStream), so you can't expect it to be always working.

It seems to be part of "MSXML2.XMLHTTP.3.0" as source for the XMLHttpRequest.
Jan 30 '09 #9
Thanks for your response.
Can i believe there is no other way of reading binary files in JavaScript in IE.
Jan 30 '09 #10
16,027 Expert Mod 8TB
If it's just IE, you can use responseBody in place of responseStream.

Then, in ActiveX, you could use the FileSystemObject, and failing that, ADO.Stream.
Jan 31 '09 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Philipp Brune | last post: by
2 posts views Thread by Giacomin Alan | last post: by
6 posts views Thread by Carolyn Vo | last post: by
5 posts views Thread by Michael Sperlle | last post: by
3 posts views Thread by TheLostLeaf | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.