Jump to content

Needing a real help :(

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1
Moody_87

Moody_87

    Newbie

  • Members
  • Pip
  • 5 posts
Hello every one,

I'm trying to build a programe using C++ (Compiling it by using MinGW + Command-line, so no GUI is required) that do the following;
first; store files in one binary file, each file composed of metadeta, file deta. The file data is encrypted using a symmetric encryption algorithm. The algorithm is specified in the metadata.
the metadeta contains
 File ID
 File name
 Original file size
 Size of the encrypted data
 File creation date
 File last modification date
 Encryption algorithm
 Encryption key, which is encrypted using the user public key. The
public key encryption used is RSA with 1024 bit key length.
 Checksum, which is computed using the hash function on the file
content. The hash algorithm used is SHA1.

- now when we add a file to the binary one we should do the following;
1. Provide the binary file, the file to be added, the encryption key and the public key
2. Encrypt the file using the encryption key
3. Encrypt the encryption key using the public key
4. Calculate the checksum of the file
5. Check if the file is already added to the binary file; if yes, delete it.
6. Add the metadata to the binary file
7. Add the encrypted file to the binary file

- then when we want to decrypt a file we should do the following;
1. Provide the binary file, the file ID to be extracted, the private key, the path where to extract the file
2. Check the file ID exists in the binary file. If not, return an error
3. Get the file metadata and the file encrypted text.
4. Decrypt the encryption key using the private key
5. Use the encryption key to decrypt the file encrypted text
6. Save the file in the specified path

i'm just a beginner and i'm really needing help to implement the previous solution :(
SO would you please help me with building this programe ? and if there is any code that doing the previous, would you please send it to me?

Thanks in advance

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What do you have so far?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Moody_87

Moody_87

    Newbie

  • Members
  • Pip
  • 5 posts
so far all what i have is just a lot of tries but without an obvious code,
the idea now is that i need two classes, one for the adding operation, and the other one for extract operation.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Even a simple main function is more than nothing. If you post what you have, however incomplete, then we can guide you to the next piece to add.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
Moody_87

Moody_87

    Newbie

  • Members
  • Pip
  • 5 posts
ok so far this is what i have

class CBinaryFile

{

public: 

   CBinaryFile();

     ~CBinaryFile();      

Add( LPCSTR lpBinaryFile, LPCSTR lpInputFile, LPCSTR lpEncryptionKey, LPCSTR lpPublicKey );

 Extract( LPCSTR lpBinaryFile, LPCSTR lpFileId, LPCSTR lpPrivateKey, LPCSTR lpPath );

 private:    // these member variables may not be necessary if the arguments    // passed to the above methods do not need to be used elsewhere

  std::string m_strBinaryFile;

  std::string m_strInputFile;  

  std::string m_strFileId;   

  std::string m_strEncryptionKey; 

  std::string m_strPublicKey;  

  std::string m_strPrivateKey; 

  std::string m_strPath;};



#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What is LPCSTR?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
Moody_87

Moody_87

    Newbie

  • Members
  • Pip
  • 5 posts
LPCSTR = const char *

#8
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
OK, now you have to implement the Extract method. Step one: open the file in binary mode.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#9
Moody_87

Moody_87

    Newbie

  • Members
  • Pip
  • 5 posts
I think that first we have to implement the add method to test the extract one right?
i've tried many ways to move a file into another bin file but i've failed, so do you have any idea?

#10
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Fair enough, but you still need to be able to open the file in binary mode. Once that's done, you can think about properly writing the data to it.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog