469,307 Members | 2,507 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,307 developers. It's quick & easy.

Reading encrypted files in Java Script.

13
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?

Regards
Wanni.
Jan 29 '09 #1
10 2839
Dormilich
8,651 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).

regards
Jan 29 '09 #2
wanni
13
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?

Regards,
wanni.
Jan 30 '09 #3
Dormilich
8,651 Expert Mod 8TB
@wanni
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
acoder
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
wanni
13
Hi,
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.

regards,
wanni
Jan 30 '09 #6
acoder
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
wanni
13
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"); 
  2.  
  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.

Regards
wanni.
Jan 30 '09 #8
Dormilich
8,651 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
wanni
13
Thanks for your response.
Can i believe there is no other way of reading binary files in JavaScript in IE.
Jan 30 '09 #10
acoder
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 suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.