Results 1 to 9 of 9

Thread: How to secure a file by password

  1. #1
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to secure a file by password

    Hi,

    I am writing an application which must be to open a file protected by a user password.

    What is the best solution to secure a file by password ?

    I imagine to copy the secured file (encrypted) into a temporary file not secured and open it. But how to do ?

    Thank you in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to secure a file by password

    If you intend to copy the contents of a file to an unencrypted file, then don't encrypt it at all

    I suggest you use some cryptographic streaming algorithm. I have once implemented a RC4 cipher as a QIODevice but you may use some ready made solutions (such as libcrypt from OpenSSL) that will decipher contents of a file into memory where you can access it, read it and wipe it out from memory when you don't need it anymore.

  3. #3
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    8
    Qt products
    Qt4 Qt/Embedded

    Default Re: How to secure a file by password

    what class file can be used to encyrpt a file ????????

  4. #4
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to secure a file by password

    I am using QCA.

  5. #5
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    8
    Qt products
    Qt4 Qt/Embedded

    Default

    Hi, i am creating a texteditor using QT. I was trying to set a password for a file. What mechanism or class should i use to set a password for a file ??

    Can you give me a minimal example that how i can make use of it in my project ??


    Added after 55 minutes:


    What is the QFile::EncoderFn and QFile::DecoderFn used for ??
    Last edited by wysota; 22nd March 2011 at 09:13.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Set a password for a file

    Depends on your specification - do you want to add a password to a file, or encrypt a file to protect the file being opened without the password ?

  7. #7
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    8
    Qt products
    Qt4 Qt/Embedded

    Default Re: Set a password for a file

    Ya. I want to add password for a file so that it will be opened if the password is correct.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Set a password for a file

    As stated before the threads were merged, use the Qt Cryptographic Architecture.

    How to use QCA depends on your specifications - the first thing you need is a cipher, and then you need to decide how to encrypt/decrypt the data using your password.

  9. #9
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Set a password for a file

    You can find an example here: http://quickgit.kde.org/?p=skrooge.g...kgservices.cpp, in function SKGServices::cryptFile.

Similar Threads

  1. Apparent error in QtCore/quuid.h
    By cwp500 in forum Qt Programming
    Replies: 11
    Last Post: 18th December 2008, 20:51
  2. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  3. file renaming on windows
    By jdd81 in forum Qt Programming
    Replies: 9
    Last Post: 2nd October 2007, 19:41
  4. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  5. QHttp GET File & Password
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2006, 13:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.