The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
juste_3al_faza said:
The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
Click to expand...
Click to collapse
I think I need to know a little more about what you are trying to do.
I am assuming a program is running on the PC. You want to capture an image of the program. Then send it to the phone through WiFi.
For it to be readable on the phone, bmp will not work. Convert it to jpg. Plenty of free algorithms and libraries can be can be found to do this.
To transfer it to the phone, I would suggest using a webserver or hosting one on the same machine. Possibly Apache, since it is free, but i am more familier with IIS.
Have your app on the pc do a post to page on localhost. Have it pass something on the querystring to identify the phone it is for. This page will store the image in a location on your computer that the webserver has access to.
Now your phone will need an app that will also hit that same ip address, not local host. You will need to know the ip address of the machine. Have it hit a different page and pass that phone identifier. The page will do a redirect to the jpg file. As you recieve the output, write it to to a file on the phone. Using Redirect should automatically send the name and mimetype with the response.
There are other more complicated ways to stream an image, but this is the simplest.
You could always have the webserver be on a different machine entirely, which would make it more generic. Yiou could even have it be hosted so it is accessible from the internet, not just the intranet.
Usign a webserver seems vastly over-complicated to me, but OK. Maybe I'm just more comfortable writing netwrok code than most people...
Take your screenshot (I assume you already managed this). Put it in a format the phone likes (JPEG is good; there might even be BMP-to-JPEG conversion code in the .NET library). Connect the phone and the PC.
This is where the network code comes in. I would personally do this by starting a TCP server socket on the PC on some arbitrary high port, more than 1024 and less than 65000. Have it "Listen()" for a request from the phone. Write a phone app that opens a TCP connection to the PC on that port. Once the phone connects, set it waiting to Receive() data. On the PC side, since some signal that you're going to transfer a file (a realllllly simple protocol would be to just send the file size, as an int, first). There are a few ways to send data on a TCP socket; you can use the Send() function which takes an array (type byte[], which could be populated by using another array and then converting), or a NetworkStream, which is just like any other member of System.IO.Stream (I'm assuming you're writing both ends in .NET, although really simple netcode is actually easier in C). To transfer the file itself, just open it and read it however you like, and send the byte array over the socket. On the phone end, create a new IsolatedStorage file, and write the data coming over the socket into it. Just read in a loop until you've read up to the size that the server told you was coming, or until you hit the end of the stream / the connection closes (which indicates a bug or a problem on the other end).
That's a dead-simple and not very robust network protocol, but it does have the advantage of being trivial to code up...
Or, if that all sounds too confusing, you can try using HTTP. I actually find that to be *more* painful, but YMMV; I cut my first netcode in C and to me HTTP feels needlessly complex by comparison (because it's meant to do so many more things than just transfer a simple byte stream like a file). If you want to look at the source code of an app that uses HTTP to send and receive files, including both the phone app and the PC server app, take a look at WP7 Advanced Explorer (it's on Codeplex). Ignore the parts about filesystem and registry for now, and just look at the network part.
To me the web server approach may seem to be the easiest solution because I have been doing dot net web programming since before dot net 1.1 came out (beta 1.0). Before that I was doing other web development using classic asp, xml, xsl, and javascript. So, I have been working with IIS for well over a decade.
Quite recently, I just worked on dot net code to stream documents and video that is not directly accessible through any virtual directory, without doing a redirect for the purpose of enforcing additional security.
Different types of programmers find different things easier. I have done little to no direct sockets programming since college, so that to me would be more difficult, even if it is actually easier.
It didn't even occur to me to try listening on a port.
Also, now that you mention it, there are ways built into dot net to convert image types. I actually use them in some of the programs I've written for Windows Mobile, such as the FB pic to Outlook Pic application. I might be converting the other way in that app though.
I don't think I do that with web service
I prefer to use the Socket.
My apps let me just view the PC screen
juste_3al_faza said:
The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
Click to expand...
Click to collapse
With the zune.
Related
All mobile browsers that I have (opera wm, opera android, android and iphone) seem to lack a proper implementation of frames. This is normally not much of a problem because who needs them? Well one really terrific piece of software that uses them to display its controls is the famous webcamXP.
There are some apps on the boards here that try to implement a viewer for webcamXP to allow the user to see their homes live ip cam feed but an app is not necessary. Download the attached file, rename it to a html extension and replace the xxx.xxx.xxx.xxx inside with your actual ip address. Place the file in the webroot directory that webcamXP created and use it when viewing remotely . Now when you access your webcam remotely on a phone the pan and up down buttons will work as expected.
hi,
i used an existing sound recorder and implmed, one by myselft.
There are some samples form MS, how to do sound recording too.
Now i want to send the recorded sound to another user's android phone.
Should be simple
- Send as email attachment
- Send via bluetooth
I did not find a program on the marketplace and trying to implent this by myself i found no example, how to do this. In this forum and on other resources, i read, that it currenty is not possible, to send email attachments programatically.
Is there really no way, to do such a simple task, as sending/sharing an audio file (after converting the recorded byte-array to .wav format) to another phone via email or bluetooth ?!
regards,
hannes
E-Mail attachment shouldnt be hard but WP7 does not support bluetooth file transport
Forget about bluetooth (until MS releases some kind of BT API). As for email attachment, you have a two options:
- implement smtp/exchange client by yourself;
- use (create) http "proxy" service on the external server (you sending audio data and additional parameters, and service forms the message with attachment).
Both ways a really not easy and expensive.
Send me a PM and I'll write something and upload it to the marketplace tonight.
MJCS said:
E-Mail attachment shouldnt be hard but WP7 does not support bluetooth file transport
Click to expand...
Click to collapse
The problem is: An email attachment in fact IS hard (impossible), without using some external service.
sensboston said:
- implement smtp/exchange client by yourself;
- use (create) http "proxy" service on the external server (you sending audio data and additional parameters, and service forms the message with attachment).
Both ways a really not easy and expensive.
Click to expand...
Click to collapse
Thank your for your response!
This is quiete the same, what i found out too. It is possible (i am a developer and i can host such a sevice on my domain) but that's not the way i like to do it.
I play in a band and recorded some demo with the phone and now want to send this recording to my band colleagues but it was not possible to do this.
This should be as simple as "open a bluetooth connection" + send.
On a windows phone, store it in the "media collection", on other phones, store it on a selectable location on the file system.
This is really anoying.
I like the platform and like developing for it but not beeing able to do such simple things...it's hard to argue, why WP is better than f.e. android.
MJCS said:
Send me a PM and I'll write something and upload it to the marketplace tonight.
Click to expand...
Click to collapse
I think, i don't get the point of your reply.
What do you want to write - a program, that does does recording audio + email it to other users?
I am searching for a solution, how to develop this by myself, not for a program on the marketplace.
regards,
hannes
HannesB said:
I think, i don't get the point of your reply.
What do you want to write - a program, that does does recording audio + email it to other users?
I am searching for a solution, how to develop this by myself, not for a program on the marketplace.
regards,
hannes
Click to expand...
Click to collapse
Oh...and I had already started programming it. Oh well. Basically do this:
Upload to SkyDrive using the API or...
Create a WCF Service that allows you to send a file stream
Have the files stream get written to the server as a GUID
Return link to file
Send link via e-mail
Have file expire after 24/hrs or something
hi,
thank you, for your response.
...and starting programming on it so fast.
(if you really started programming it - put it on marketplace, i am sure, many people would like souch a tool)
The "problem" with this approach (and email too) is:
- i need an internet connection to upload
- the people that want to download the file, need an internet connection
- there are still people, that don't have an internet flatrate for their phone or any internet connection (or have to use roming, if not at home) and jus say "..hey, you recorded it - send it to me via bluetooth".
Seem's, the steps you discribed, are the only option, to do it. The phone i used 5 year ago, could send pictures and audio recording via bluetooth and since the mango update is currently released and doest not contain an api for bluetooth access, i think it will not be released soon, if ever.
In another posting i read: "I take a picture with me and my friends and i can't send them over the bluetooth. They have cheap dumbphones and I have Omnia 7 and I'm embarrassed. Bluetooth filetransfer is essencial feature."
Ok, this is "offtopic" now, sorry but anyway thank you for your responses.
The steps you explained are possible for sure, but in my opinion a bit "much work", for simply sending some data != text.
HannesB, I agree with you, it's kinda annoying. But, probably, MS will open some new APIs in future (WP7 is based on WinCE so it's not such a big deal, code/drivers are already exists for that platform). Don't forget - WP7 platform is still too new.
I have an app called CopyCat. It will let you do recordings (and change the playback as well).
http://www.windowsphone.com/en-US/search?q=copycat
It will let you store to the Public folder of your DropBox account.
As previously mentioned, unfortunately there is no way to attach WAV files to an email currently.
Hope this can be of help.
Why are you guys complaining about a function that you can have with evernote you can record sound and save it on your evernote account over your windows phone
In order to develop an app remote desktop WP7, I started to with a desktop simple viewer and it works
but the problem that not show all actions that I do in Server side, that's video in YouTube can show you my problem
"watch?v=3q-FumfYsPQ&feature=youtu.be" (add it after /)
I use socket connection and I decode and encode my data (images).
this my code in WP7 client side
void Conncet(string IP_Address) {
client_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs()
{
RemoteEndPoint = new IPEndPoint(IPAddress.Parse(IP_Address), 4532)
};
socketEventArg.Completed += OnConncetCompleted;
client_socket.ConnectAsync(socketEventArg);
}
void StartReceiving()
{
byte[] response = new byte[131072];
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.Completed += OnReceiveCompleted;
socketEventArg.SetBuffer(response, 0, response.Length);
client_socket.ReceiveAsync(socketEventArg);
}
private void ViewReceivedImage(byte[] buffer)
{ try { MemoryStream ms = new MemoryStream(buffer);
BitmapImage bi = new BitmapImage();
bi.SetSource(ms); MyImage.Source = bi;
ms.Close();
}
catch (Exception) { }
finally { StartReceiving();
} }
this my code in Server side (PC) sending images
void StartSending() { while (!stop)
try
{
Image oldimage = scr.Get_Resized_Image(wToCompare, hToCompare, scr.GetDesktopBitmapBytes());
//Thread.Sleep(1);
Image newimage = scr.Get_Resized_Image(wToCompare, hToCompare, scr.GetDesktopBitmapBytes());
byte[] buffer = scr.GetDesktop_ResizedBytes(wToSend, hToSend);
float difference = scr.difference(newimage, oldimage);
if (difference >= 1)
{
SenderSocket.Send(buffer);
}
}
catch (Exception) { }
}
My question is how can I make the send and receive fast to show the PC screen in WP7 in +/- real time.
The short answer is, you can't. Even if you compress the screen images first, which I note you're not doing, the amount of data is just too great. An uncompressed 800x480x32-bit image (such as WP7's screen can display) is 1.5MB. That's each frame. You can halve that by using 16-bit color, of course; now it's .75MB per frame. If you want even 20 frames per second - which is slower than TV or almost any video camera, but is moderately smooth for most things - that's 15 MB/sec, which is 120Mbps (about twice the speed of most WiFi, faster even than most wired networks).
With some simple image compression combined with clever data differencing (sending only the parts of the image that change), you could probably reduce that data load by at least a factor of 10. That's still too high for most Internet connections (even if your phone can download 12 Mbps, your PC probably can't upload it) but it might be usable over WiFi (802.11n probably, 802.11a or g maybe). You'd have to make your code quite a bit more complicated, of course. Additionally, the phone's processor would have to work a lot harder, since it would be decompressing the data and applying it to the changed part of the frame, instead of just dumping netowrk packets into an image buffer.
The real solution, of course, is to use one of the several programs and protocols that already exist and have the intended purpose of doing exactly what you're trying to do. The most common on Windows is called Terminal Services or Remote Desktop (Remote Desktop Protocol). Nearly all versions of Windows come with the client, and the better editions come with the server. On WP7, there are already some client apps available; the one I use is called "RemoteDesktop" (no space). Note that, in addition to having a well-optimized algorithm for screen updates (but it's *still* not going to be smooth for things like movies or games), Remote Desktop Protocol lets you control the PC directly as well.
Thanks
I look that's apps in marketplace and it looks very difficult to me, but I develop simple viewer and next time I will develop the code that can remote the PC.
the idea about send only that pixels that changed between the old image and the new image is really good, but how I ca send only that pixel and they're position in the image, that's a question.
And about compression, how I can do that with images?
Well, just compressing the full screen to .PNG or .JPG and sending it would shrink things considerably. There are .NET libraries available (there might even be one in the core library) for image compression. Alternatively, there are some excellent C/C++ libraries available, if you can code native interop. I know the phone has built-in capability to handle JPG, not sure about PNG though.
However, once the data is compressed it's hard to extract a part of it and send just that part. What I suggest you do instead is identify the portion of the image that changed. For example, if all the changed pixels fall within one rectangle, use that. Send the coordinates of the rectangle (its origin and either the opposite corner or the length/width), followed by the updated data. On the phone, listen for the rectangle to update, then write the updated data into those coordinates on the display.
Note that you may want to send multiple rectangles - for example, if the top left nd bottom right pixels change, but nothing else does, a single rectangle that encompasses both of them would have to be the entire image. Instead, send two tiny rectangles - one for each corner - and you can massively reduce the data needed. However, the process of quickly detecting a good way to break up an image into the parts that are and are not moving is tricky. You're essentially trying to create a video compression algorithm here, and although I know a little of the theory, it's totally not my area and I don't know much more than what I've told you so far.
Thanks again
I found something similare to know the pixel that chaged
Image Comparison using C#
http://www.c-sharpcorner.com/uploadfile/prathore/image-comparison-using-C-Sharp/
I will try to study it and get information how to set the coordinates, but the problem that stay is how I send it to the right position in image in client side
juste_3al_faza said:
I look that's apps in marketplace and it looks very difficult to me
Click to expand...
Click to collapse
I don't understand that. What is "difficult"? Enable RDP access on desktop? Or add your desktop ip address to the WP7 app? Take a look to the RemoteDesktop app by Topperware: it's fast, professionally designed and easy to use but of course not a free (however $4.99 is not much!)
As for me, it looks like you are trying to "invent a bicycle" but without basic knowledge how the remote access protocols should work. It's not that easy like just a transfer bitmap images via sockets...
I mind I don't need to use it, I want to develop a simple apps because its my project and I will get a note and pass my last year in school
juste_3al_faza said:
I mind I don't need to use it, I want to develop a simple apps because its my project and I will get a note and pass my last year in school
Click to expand...
Click to collapse
Now I understand OK, I can recommend you to dig in MJPEG. There are few Silverlight classes available on the web (you may google em); they may simplify your job. The picture quality isn't good or sharp enough but should be good for the student project.
you talk about compression images to mpeg????????????
have you an idea when I zoom In image in WP7, most image be clear to see, how I can do it?
Edit (After see the article about MJPEG silverlight)
It use the HTTP connexion and I use socket, It can work together?
If yes how I can combine with it (plz a sample code can help )
No, I'm talking about M(otion)JPEG over HTTP, easiest possible video streaming implementation. For the solution, you need to implement your own M-JPEG HTTP server application, and on WP7 you may use (it's already exists, google for MJPEG MediaStreamSource) MediaElement. And I don't understand your second question.
I already edit my previous post
and about the 2nd question, I mean when to pinch in WP7 screen, is the image will be clear or not.
I don't have time to write an example for you; however it's your project or homework , I just give you a direction.
As for seconds question (as far as I understand): it's depends from the image dimensions and JPEG compression level. If you resize 1920x1080 image to 800x480 with 50% quality, resulting image will looks not so good.
P.S. Check this project: http://mjpeg.codeplex.com/ To estimate output quality on Wp7, you may use any MJPEG desktop streaming solution (vlc, for example).
Thanks a lot
I finished my app and it work good, see the video
http://www.youtube.com/watch?v=cCwsuj7Hcno
Cool. Looks like you get about a frame per second, which won't work for showing a video but is fine for a Powerpoint or something, and a decent proof of concept.
I'm not sure I'd recommend demoing using a video showing a commercial movie with a clearly visible "Uploaded by..." comment, at least in the USA schools tend to frown on open displays of media piracy. Otherwise, well done.
Ok next time I will use PowerPoint to use my app show
Hi I succeed to finish my code of simple viewer PC screen. Work with WP7
See the video
http://www.youtube.com/watch?v=cCwsuj7Hcno&list=HL1330329890&feature=mh_lolz
Now I will go to try how control the mouse?
About my app I use socket to connect to the server, no RDP protool and its word good. I try it on different machines and networks (@IP) and work perfect.
My app is a last year project so any idea about how to control the cursor.
This probably should have been in the same thread, but anyhow...
It depends on how your protocol is designed. Currently, all the data is pushed from the PC to the phone. To control the cursor, your phone needs to push data to the PC, which means that the PC server app needs to check for data from the phone app.
Sensing a touch on the phone is easy. Sending those coordinates over the network is pretty easy as well; you figured out sending video so I assume you can handle this part. On the PC, you'll want to receive those coordinates and then multiply them back out to their equivalent positions at the PC's resolution. Then you need to move the mouse cursor. There are Windows APIs for doing this, but I've never messed with them. They might be exposed to .NET, but I'm guessing that you'll need to make a call into native code (this is pretty easy, though; look up P/Invoke). Clicking can be implemented by having the phone detect that you tapped the same spot where the cursor already is, and having it send a different message to the server.
The messages will need to be determined by you, as the designer of the protocol. I do recommend using different messages for "move the cursor to here" and "click where the cursor is now." As for when to send the message, that also depends on how you implemented the app. If the entire transmission of the screen frame is one long socket send/receive, you'll have to exchange cursor commands between frames. If you do multiple smaller chunks, you can check for a cursom command and update the position or click as appropriate. Another alternative is to create two socket connections, and have the second one be used for cusor commands. I don't recommend this, though - it's not needed, it takes more code, and although I feel that everybody *should* learn multi-threaded netcode development, I'm not sure it what you want to work on now.
I am really confused
But I will try to get the coordinate of cursor from PC and move it on WP7 screen at first, if I succeed I will develop code tap (click), double tap and drag.
I am really confused
No one can help!!!!!!!!!!!!
Google should be your best helper - try to work with google first.
On WP7 app side you need to grab tap position, translate it to desktop coordinates and send data to the server. On the server side you may use Win32 API function SendInput() http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
SendInput can emulate mouse and keyboard events.
P.S. As for youtube video: try your project on the real device, using WiFi or 3G, and you will understand what RDP protocol was built for
Yes I use Google for that,its the best search engine
I understand that use the coordinates to locate the position, and send it from WP7 to PC.
But my question is how any sample code can hep?
I implemented a browser based encryption solution which runs on Windows RT (and many other Windows computers). All I wrote was the HTML page, I am leveraging Crypto.JS javascript library for encryption algorithm. I am using the HTML 5 File API implementation which Microsoft provides for reading and writing files.
I make no claim on this but seems to work good for me. Feel free to feedback if you have any suggestions. The crypto.js library supports many different algorithms and configuration so feel free to modify it to your own purposes.
You can download the zip file to your surface, extract it and load the TridentEncode.htm file into Internet Explorer.
If you want to save to custom directory you probably need to load it from the Desktop IE instead of metro IE (to get the file save dialog). I usually drag and drop the file onto desktop IE and from there I can make favorite. This should work in all IE 11 and probably IE 10 browsers... if you use other browsers you may need to copy paste into the fields since the File API implementation seems rather browser specific. Running the html page from the local filesystem means that there is no man-in-the-middle which helps eliminate some of the vulnerabilities of using a javascript crypto implementation. You could also copy the attached zip file to your skydrive to decrypt your files from other computers.
Skydrive files in theory are secure (unless they are shared to public) so this might be useful for adding another layer of protection to certain info.
Again, use at your own risk, but feel free to play around and test it, and offer any suggestions or critiques of its soundness, or just use it as a template for your own apps.
Ok... this is really cool! Nice idea, and a good first implementation.
With that said, I have a few comments (from a security perspective). As an aside, minimized JS is the devil and should be annihilated with extreme prejudice (where not actually being used in a bandwidth-sensitive context). Reviewing this thing took way too long...
1) Your random number generation is extremely weak. Math.random() in JS (or any other language I'm aware of, for that matter) is not suitable for use in cryptographic operations. I recommend reading http://stackoverflow.com/questions/4083204/secure-random-numbers-in-javascript for suggestions. The answer by user ZeroG (bottom one, with three votes, as of this writing) gets my recommendation. Unfortunately, the only really good options require IE11 (or a recent, non-IE browser) so RT8.0 users are SOL.
NOTE: For the particular case in question here (where the only place I can see that random numbers are needed is the salt for the key derivation), a weak PRNG is not a critical failing so long as the attacker does not know, before the attack, what time the function is called at. If they do know, they can pre-compute the likely keys and possibly succeed in a dictionary attack faster than if they were able to generate every key only after accessing the encrypted file.
2) Similarly, I really recommend not using a third-party crypto lib, if possible; window.crypto (or window.msCrypto, for IE11) will provide operations that are both faster and *much* better reviewed. In theory, using a JS library means anybody who wants to can review the code; in practice, the vast majority of people are unqualified to either write or review crypto implementations, and it's very easy for weaknesses to creep in through subtle errors.
3) The default key derivation function (as used for CryptoJS.AES.encrypt({string}, {string})) is a single iteration of MD5 with a 64-bit salt. This is very fast, but that is actually a downside here; an attacker can extremely quickly derive different keys to attempt a dictionary attack (a type of brute-force attack where commonly used passwords are attempted; in practice, people choose fairly predictable passwords so such attacks often succeed quickly). Dictionary attacks can be made vastly more difficult if the key derivation process is made more computationally expensive. While this may not matter so much for large files (where the time to perform the decryption will dominate the total time required for the attack), it could matter very much for small ones. The typical approach here is to use a function such as PBKDF2 (Password-Based Key Derivation Function) with a large number of iterations (in native code, values of 20000-50000 are not uncommon; tune this value to avoid an undesirably long delay) although other "slow" KDFs exist.
4) There's no mechanism in place to determine whether or not the file was tampered with. It is often possible to modify encrypted data, without knowing the exact contents, in such a way that the data decrypts "successfully" but to the wrong output. In some cases, an attacker can even control enough of the output to achieve some goal, such as compromising a program that parses the file. While the use of PKCS7 padding usually makes naïve tampering detectable (because the padding bytes will be incorrect), it is not a safe guarantee. For example, a message of 7 bytes (or 15 or 23 or 31 or any other multiple of 8 + 7) will have only 1 byte of padding; thus there is about a 0.4% (1 / 256) chance that even a random change to the ciphertext will produce a valid padding. To combat this, use an HMAC (Hash-based Message Authentication Code) and verify it before attempting decryption. Without knowing the key, the attacker will be unable to correct the HMAC after modifying the ciphertext. See http://en.wikipedia.org/wiki/HMAC
5) The same problem as 4, but from a different angle: there's no way to be sure that the correct key was entered. In the case of an incorrect key, the plaintext will almost certainly be wrong... but it is possible that the padding byte(s) will be correct anyhow. With a binary file, it may not be possible to distinguish a correct decryption from an incorrect one. The solution (an HMAC) is the same, as the odds of an HMAC collision (especially if a good hash function is used) are infinitesimal.
6) Passwords are relatively weak and often easily guessed. Keyfiles (binary keys generated from cryptographically strong random number generators and stored in a file - possibly on a flashdrive - rather than in your head) are more secure, assuming you can generate them. It is even possible to encrypt the keyfile itself with a password, which is a form of two-factor authentication: to decrypt the data that an attacker wants to get at, they need the keyfile (a thing you have) and its password (a thing you know). Adding support for loading and using keyfiles, and possibly generating them too, would be a good feature.
The solutions to 3-5 will break backward compatibility, and will also break compatibility with the default parameters for openssl's "enc" operation. This is not a bad thing; backward compatibility can be maintained by either keeping the old version around or adding a decrypt-version selector, and openssl's defaults for many things are bad (it is possible, and wise, to override the defaults with more secure options). For forward compatibility, some version metadata could be prepended to the ciphertext (or appended to the file name, perhaps as an additional extension) to allow you to make changes in the future, and allow the encryption software to select the correct algorithms and parameters for a given file automatically.
Wow thanks GDTD that's great feedback
Not sure about his minified sources, the unminified aes.js in components is smaller than the minified version (which I am using) in rollups. I'll have to look into what his process for 'rollup' is to see if I can derive a functional set of non-minified script includes. If I can do that it would be easier to replace (what I would guess is) his reliance on Math.random.
His source here mirrors the unminified files in components folder : https://code.google.com/p/crypto-js/source/browse/tags/3.1.2/src
msCrypto that would be great, I had no idea that was in there. I found a few (Microsoft) samples so I will have to test them out and see if I can completely substitute that for crypto.js. Would be more keeping in line with the name I came up with.
Currently this version only works for text files, I am using the FileAPI method reader.readAsText(). I have been trying to devise a solution for binary files utilizing reader.readAsArrayBuffer but as yet I haven't been able to convert or pass this to crypto.js. I will need to experiment more with base64 or other interim buffer formats (which Crypto.js or msCrypto can work with) until I can get a better understanding of it.
Metadata is a great idea, maybe i can accommodate that with a hex encoded interim format.
You seem extremely knowledgeable in the area of encryption, hopefully i can refine the approach to address some of the issues you raised by setting up proper key, salt, and IV configuration... I'm sure I will understand more of your post as i progress (and after reading it about 20 times more as a reference).
Too bad we don't a web server for RT, that would at least open up localStorage for json serialization (mostly for other apps I had in mind). I guess they might not allow that in app store though. Could probably run one of a developers license though (renewed every 1-2 months)?
nazoraios said:
Too bad we don't a web server for RT, that would at least open up localStorage for json serialization (mostly for other apps I had in mind). I guess they might not allow that in app store though. Could probably run one of a developers license though (renewed every 1-2 months)?
Click to expand...
Click to collapse
I cant comment too much on the encryption, GoodDayToDie has covered anything I could contribute and more. But there is a functioning web server on RT. Apache 2.0 was ported: http://forum.xda-developers.com/showthread.php?t=2408106 I dont know if everything is working on it, I dont own an RT device and last time I tried I couldnt get apache to run on 64 bit windows 8 anyway (needed it at uni, spent hours going through troubleshooting guides and it never worked on my laptop, gave up and ran it under linux in virtualbox where it took 2 minutes to have functioning the way I needed it to).
Curious about the performance. Speaking of encryption, 7-Zip has it built-in, and from the discuss in StackExchange, it seems pretty good.
One of the neat things about this thing (local web app? Pseudo-HTA (HTml Application)? Not sure if there's a proper name for such things) is that it runs just fine even on non-jailbroken devices. That's a significant advantage, at least for now.
Running a web server should be easy enough. I wrote one for WP8 (which has a subset of the allowed APIs for WinRT) and while the app *I* use it in won't be allowed in the store, other developers have taken the HTTP server component (I open-sourced it) and packaged it in other apps which have been allowed just fine. With that said, there are of course already file crypto utilities in the store anyhow... but they're "Modern" apps so you might want to develop such a server anyhow so you can use it from a desktop web browser instead.
Web cryptography (window.crypto / window.msCrypto) is brand new; it's not even close to standardization yet. I'm actually kind of shocked MS implemented it already, even if they put it in a different name. It's pretty great, though; for a long time, things like secure random numbers have required plugins (Flash/Java/Silverlight/whatever). Still, bear in mind that (as it's still far from standardized), the API might change over time.
Yep, I think of them as Trident apps since trident is what Microsoft calls their IE rendering engine, but I guess they are sort of offline web apps (which come from null domain). Being from null domain you are not allowed to use localstorage which is domain specific. You also are not allowed to make ajax requests. You just have file api and json object serialization to make do with I/O.
Another app I am working on is a kind of Fiddler app similar to http://jsfiddle.net/ where you can sandbox some simple script programs.
Kind of turning an RT device into a modern/retro version of a commodore 64 or other on-device development environments. Instead of basic interpreter you've got your html markup and script.
I have an attached demo version which makes available jquery, jquery-ui, alertify javascript libraries in a sandbox environment that you can save as .prg files.
I put a few sample programs in the samples subfolder. Some of the animation samples (like solar system) set up timers which may persist even after cleared so you might need to reload the page to clear those.
It takes a while to extract (lots of little files for all the libraries) but once it extracts you can run the html page and I included a sample program 'Demo Fiddle.prg' you can load and run to get an idea.
I added syntax highlighting editors (EditArea) which seems to work ok and let's you zoom each editor full screen.
The idea would be to take the best third party javascript libraries and make them available and even make shortcuts or minimal API for making it easier to use them. Common global variable, global helper methods, ide manipulation. I'd like to include jqplot for charting graphs, maybe for mathematical programs and provide api for user to do their own I/O within the environment.
These are just rough initial demos, and obviously open source so if anyone wants to take the ideas and run with them i'd be interested in seeing what others do. Otherwise I will slowly evolve the demos and release when there are significant changes.