two suggestions

two suggestions

Postby SeL on Wed Sep 27, 2006 2:45 am

Hi, I think this program could become very useful. I am trying to set up encrypted file transfer within a group, where some users have little technological knowledge and/or lack the rights or abilities to install PGP. There is one essential suggestion and one request.

1. You can not ask for the password just once in a hidden input field (where characters are shown as stars) and then use that to encrypt the file. There is no way of knowing if the password has been entered correctly. You need to ask for the encryption password twice, preferrably within the same dialog (so QInputDialog::getText would have to replaced by a self-defined dialog). This is a widely opened door to data loss, and it prevents me from recommending the program to my prospective users right now. Don't ask twice before decryption though. ;-)

2. As group members work on files collaboratively and are probably going to use qccrypt to pass on intermediate versions, I would need a checkbox "keep existing file", both for encryption and decryption. If it is checked, you would have to modify the way ccrypt is run. You would construct the target file name yourself and then redirect stdin to the source file and stdout to the target file. That's the only way of preventing qccrypt from deleting the file it has encrypted or decrypted.

3. Language corrections: in English, there is no space before a colon (look at the way I have started this paragraph) or before an exclamation mark! (Again, here's an example.) And "successful" does not end in two "l"s. In the text "The file specified as a parameter on the command line did not found !" the word "did" must be "was". The word "environement" must be spelled "environment". And if you want to correct file names, the word "ressources" is actually "resources".

Thanks for any response, it would be very good indeed if I could see a version with the described features.
SeL
 
Posts: 4
Joined: Wed Sep 27, 2006 2:13 am
Location: Germany

Postby webmaster on Fri Sep 29, 2006 9:40 am

Hi SeL,

Thank you for all your suggestions and you interest in qccrypt, and excuse me for my bad english :oops: (I'm french). I see that you speak a better english than me! :wink: I will correct my language's mistakes in qccrypt for the next release.
I'm currently working on the version 2.0 wich will be able to encrypt/decrypt an entire folder in one pass, an I will try to add the features you asked. I already envisaged to correct the problem of asking only one time the password for encryption. So, it will be ok for your wish 1 and 3, but I don't understand your second wish :roll: .
SeL wrote:2. As group members work on files collaboratively and are probably going to use qccrypt to pass on intermediate versions, I would need a checkbox "keep existing file", both for encryption and decryption. If it is checked, you would have to modify the way ccrypt is run. You would construct the target file name yourself and then redirect stdin to the source file and stdout to the target file. That's the only way of preventing qccrypt from deleting the file it has encrypted or decrypted.

Could you explain me this point with an example ?


I don't have a lot of time to develop, so this future version will not be out in two days... And don't forget that it's a GPL program that you can freely modify as you wish, so if you can't wait the next release, don't hesitate to adapt my version for your own needs.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby SeL on Fri Sep 29, 2006 12:50 pm

Hi Philippe,

thanks for the kind response. I am in fact translating the award speeches for the German Big Brother Awards (http://bigbrotherawards.de/en) and exchanging the German speeches with other translators, that's why I'm interested in an easily usable program as well as in language matters. :-)

I do also do software development but have never used the QT API, that's why I thought I'd better not try to make the changes myself. I need to make progress on those translations ... We will probably use other means of communication now but I'm still interested.

About item 2: I'd like to be able for a group member to keep his or her copy of a file on the personal disk but send out an encrypted version to the group. It might just be a preliminary version that they want to others to review (as in the case of my group). So they want to create an encrypted version to attach to an email and then perhaps continue working. It would be inconvenient if they would have to recreate an unencrypted file just because qccrypt has deleted the original. I then added how you need to operate ccrypt to achieve this: redirect stdin and stdout so ccrypt does not see the name of a file on the command line, it won't delete anything then. As a consequence, you need to find the name of the "result" file yourself, instead of ccrypt doing it for you, because you need those for stream redirection. But I see that you're probably doing that anyway because you are doing an overwrite check (very useful idea).

Do ask again if necessary, I am watching this thread of course.

Sebastian
SeL
 
Posts: 4
Joined: Wed Sep 27, 2006 2:13 am
Location: Germany

Postby webmaster on Fri Sep 29, 2006 1:16 pm

Hi Sebastian,

Thank you for your answer. Now, I have understood your need :D.
In fact, I use the default behaviour of ccrypt program which overwrites the file you want to encrypt by the encrypted one in order to keep (I suppose) the same date/time for the file. It's the same thing for the decryption process.
I will search for a ccrypt command line option to avoid this overwrite (perhaps the option -T), and will let this choice using a checkbox "keep existing file".

Don't worry if the version 2.0 is not out in few days, because I miss time. I can already say that I have corrected my language mistakes on this future version! :wink:
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby SeL on Fri Sep 29, 2006 1:34 pm

Hi Philippe, I looked at all the command line options but none of them does it. -T means ccrypt won't write directly into the original file but into a new one, then rename it to the target file name and delete the original. It is less safe because the original data is left in empty space on the file system. That's why ccrypt --help says "use temporary files instead of overwriting (unsafe)" for -T. (On the other hand, if there is a crash during encryption you don't end up with a partially encrypted/decrypted file.)

The only way I found is to use stdin/stdout redirection, as in ccrypt -e <original >original.cpt, and that's why you need to compute the target file name. The same principle for decryption of course.

Thanks again for taking this interest in my suggestions. I will very likely be using and recommending the new version.

Sebastian
Last edited by SeL on Fri Sep 29, 2006 1:36 pm, edited 1 time in total.
SeL
 
Posts: 4
Joined: Wed Sep 27, 2006 2:13 am
Location: Germany

Postby webmaster on Fri Sep 29, 2006 4:31 pm

Hi Sebastian,

Thank you for your sample that I tested successfully! :D
I will base my work on it to develop this option.

Philippe.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby webmaster on Fri Oct 13, 2006 1:23 pm

Qccrypt 0.2 is almost finished (recursive folder encryption capability, double password confirmation for encryption process), but I encounter a problem with coding the part of code which permit to keep the original file during encryption process.
If someone can help me, I would be very happy.

I want to have this command line (by example) :

ccrypt -e -f -K MyPassword < C:/TheFileToEncypt.Extension > C:/TheFileToEncypt.Extension.cpt


This is the part of code that I wrote to implement it :

Code: Select all
         ....
         QString program = "ccrypt";
         QStringList arguments;
         
         if (ccdlg_ui.keepExistingFileCheckBox->isChecked())
         {
            QString lastParameter = currentFileInfo.absoluteFilePath() + ".cpt";
            arguments << "-e" << "-f" << "-K" << password << "<" << currentFileInfo.absoluteFilePath() << ">" << lastParameter;
         }
         else
         {
            arguments << "-e" << "-f" << "-K" << password << currentFileInfo.absoluteFilePath() ;
         }
         QProcess *encryptProcess = new QProcess(this);
         encryptProcess->start(program, arguments);
         
         encryptProcess->waitForFinished();
         ....


Thank you by advance.

Philippe.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby SeL on Sat Oct 28, 2006 2:35 pm

Hi Philippe, I did not get a notification email (probably because I was not the last person to post) so I only saw your question now. I was curious to see how the new features were doing. :-)

The problem is that putting >a or <b in the command line will not cause stdin/stdout redirection. This is done by a command line processor (the Unix shell or CMD.EXE on Windows), and then the < ... and > ... arguments are actually taken out of the command line, the subprocess never sees them. So instead of calling your executable (ccrypt) directly, you would need to call some command line processor and pass your command line to it, i.e. use something like sh -c "ccrypt ... <infile >outfile" as arguments to your QProcess, but that would vary a lot from platform to platform.

The better solution is to redirect the streams "by hand". You need to do this in the child process, not the parent, so you need a chance to have the child run some code supplied by you before it runs the ccrypt executable. Under Unix, the fork() system call offers such a chance. I don't know Qt, but I've just done some web searching and I think this is the way to do it in Qt: implement a subclass of QProcess that overrides the protected member function "setupChildProcess". This is called in the child process before it starts up the executable. There is a similar example on the web at http://blogs.qtdeveloper.net/archives/2 ... -qprocess/ , in fact this one does more than you need. In that example the problem was that QProcess closes the original stdin and stdout and redirects them into pipes so the parent can write to and read from the child. Normally, the child would inherit all files from the child, but QProcess discards stdin and stdout when it provides these pipes. In the example the aim is to keep the same stdin in the child that the parent has, so the stream is duplicated in the parent (in the class constructor) and the child will inherit it in an extra file descriptor (which QProcess won't close). When QProcess starts the child, it closes and redirects stdin to the pipe, then (in setupChildProcess) that pipe is closed by the child (implicitly, this is a side-effect of the call to dup2 there) and replaced by the original stdin.

You don't need to preserve the parent's stdin and stdout in the child, so you can probably leave your constructor empty. Well, maybe you should try opening the files in the parent process so that you can display any errors, maybe the constructor is the right place to do that, maybe it isn't. Then your child process would inherit those open files, so in your setupChildProcess, you just close the child's stdin and stdout and duplicate the open files to stdin/stdout. That should do it.

No, I forgot something: if you open the files in the parent process, you need to close them there as well, after they have been inherited by the child. Sorry, I don't know if there is a function within QProcess that the parent calls after the child has been started.

Sebastian
SeL
 
Posts: 4
Joined: Wed Sep 27, 2006 2:13 am
Location: Germany

Postby webmaster on Tue Oct 31, 2006 9:51 am

Hi Sebastian,

Thank you for your help and your search. I have just read your post because I was in Paris for some days for the work.
I will investigate your solution as soon as possible.
Meanwhile and if your are interested, I can send you by email the current source files (or binary, as you want) to test the new functions.

Philippe.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby webmaster on Wed Nov 22, 2006 4:23 pm

Hi Sebastian,

I found the time to implement the possibility to keep the original file during the encryption process.
I firstly understood why the redirection commands "<" and ">" does not work as arguments in Qccrypt : in fact, this redirection command is a feature of the shell program (command.com, cmd.exe, sh, ..). If I want to use it as it, I have to run the appropriate shell of the current Operating System, and send the commands by writing them to Stdin: I didn't choose this option for its bad portability.

So, I looked for two other solutions:
- Read the Stdout channel: I did not found the technical appropriate solution (I can only capture the stdout screen informations => not interesting !).
- Copy the file just before encryption to a temporary name (the original file name + the extension ".original"), launch encryption, and rename the temporary file name to the original one: it's the solution that I retained and implemented.

You can download and test the Windows version here: http://qccrypt.free.fr/download/qccrypt-0.2-win32.zip
The source code is available here: http://qccrypt.free.fr/download/qccrypt-0.2-src.zip

I would be pleased if you could test this version and tell me your feeling about it. If I don't have any answer from you in few days, I will publish this version officially on my web site.

Thank you for your interest in Qccrypt !

Philippe.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby webmaster on Fri Dec 01, 2006 2:54 pm

I found redirection functions for QProcess that have been introduced into version 4.2 of QT libraries :

Code: Select all
void QProcess::setStandardInputFile ( const QString & fileName );
void QProcess::setStandardOutputFile ( const QString & fileName, OpenMode mode =
Truncate )


I tested them on Qccrypt successfully on Kubuntu GNU/Linux 6.10 and Windows XP. This is the part of encryption code :

Code: Select all
                        QString program = "ccrypt";
                        QStringList arguments;
                        QProcess *encryptProcess = new QProcess(this);


                        if (ccdlg_ui.keepExistingFileCheckBox->isChecked())
                        {
                                arguments << "-e" << "-f" << "-K" << password;
                                encryptProcess->setStandardInputFile(QString(currentFileInfo.absoluteFilePath()));
                                encryptProcess->setStandardOutputFile(QString(currentFileInfo.absoluteFilePath()
+ ".cpt"));
                        }
                        else
                                arguments << "-e" << "-f" << "-K" << password <<
currentFileInfo.absoluteFilePath() ;
                        encryptProcess->start(program, arguments);
                        encryptProcess->waitForFinished();
                        int returnCode = encryptProcess->exitCode ();


You can also download the complete source code here : http://qccrypt.free.fr/download/qccrypt-0.2-alpha-src.zip but it's still under development and so not finished and tested, so be carrefull !
To compile, be sure to have QT 4.2.1 libraries (available on the Trolltech web site http://www.trolltech.com/).
The Windows binary is available here : http://qccrypt.free.fr/download/qccrypt-0.2-alpha-win32.zip.
To run this binary, you also need the QT 4.2.1 libraries available here : http://qccrypt.free.fr/download/qt4.2.1-win32_dll.zip.

Good tests !
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm

Postby webmaster on Sun Dec 10, 2006 8:03 pm

A new alpha version of Qccrypt 0.2 can be downloaded here:

Source code: http://qccrypt.free.fr/download/qccrypt-0.2-alpha-src.zip.
To compile, be sure to have QT 4.2.1 libraries (available on the Trolltech web site http://www.trolltech.com/).
Windows binary is available here : http://qccrypt.free.fr/download/qccrypt-0.2-alpha-win32.zip.
To run the Windows binary, you also need the QT 4.2.1 libraries available here : http://qccrypt.free.fr/download/qt4.2.1-win32_dll.zip.

I optimized the source code, corrected some bugs, and add improvements (but all the functionalities are frozen). As it's an alpha version, all the functionalities are not coded, but the first beta version will not be so long to come.

Great thanks to SeL for some parts of code !

Philippe.
webmaster
Site Admin
 
Posts: 15
Joined: Thu Aug 24, 2006 3:59 pm


Return to Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron