PDA

View Full Version : Enctrypted file uploads to a server



hardgeus
11th December 2006, 22:31
I need to implement enctrypted file uploads from my QT application in Windows. The user will select a directory, and everything in that directory will be uploaded to the server. I need to make it smart enough such that if half of the files are uploaded and then an error occurs, on subsequent uploads it will be able to check the server to see what, if any, of the files in the selected directory have already been uploaded.

From what I can see, QT does not support SFTP at all, and I have been unable to find any GPL libraries that I can link with. So SFTP seems to be out of the question.

I considered using Qftp and tunneling FTP over SSH, but my users are very non-technical, and I don't know of any way to tunnel FTP over SSH without requiring the user to manually make the SSH connection. I'm not going to be able to push a solution that requires retraining of the users.

Right now I am leaning toward using HTTP, but the approach I'm considering seems rather cumbersome and I was wondering if there was a better, simpler way to accomplish this goal. I was considering using HTTPS with QHTTP, and doing server-side authentication using PHP for the upload and other pages (my QT app would post username/password to the login page, and would have to keep track of the session cookie for login state). I was considering implementing the functionality for server-side directory creation and checking for the existance of files using a PHP page that I could pass requests to through Post variables, and responded with a simple XML formatted response (Basically like an AJAX thing, except from my QT app instead of a web browser)

This isn't a QT question per se, but my app is a QT4 app, and there may be an infinitely simpler solution to this problem that is built into QT. Is there any simple way to implement encrypted file uploads using QT? I have a lot of flexibility with what I can put on my (Linux) fileserver.

wysota
11th December 2006, 23:02
I considered using Qftp and tunneling FTP over SSH, but my users are very non-technical, and I don't know of any way to tunnel FTP over SSH without requiring the user to manually make the SSH connection. I'm not going to be able to push a solution that requires retraining of the users.
You can use stunnel (http://stunnel.mirt.net/) through QProcess to set up an SSL connection to your server. Your users won't have to touch a thing and you'll have a decent secure connection with only a light dependency.

hardgeus
11th December 2006, 23:05
You can use stunnel (http://stunnel.mirt.net/) through QProcess to set up an SSL connection to your server. Your users won't have to touch a thing and you'll have a decent secure connection with only a light dependency.

I was looking at that earlier today, but according to the FAQ it won't work with FTP:
http://www.stunnel.org/faq/troubleshooting.html#ToC18

wysota
11th December 2006, 23:10
This is not entirely true (it would require a special FTP server), but still you don't have to use FTP itself, right? There is a service FTPS which is FTP over SSL but you can also use your custom protocol, HTTP or whatever else you want that uses a single port to communicate.