tags:

views:

39

answers:

2

if i have both encrypted message and signature (let's say two different size files), i just want to append them and store in a file together but later i will use the same "only one file" to extract the files and verify in my code.

in that way my code will get only one file as an input but can understand which is encrypted file and signature file...

this file will be used in C or C++ program, will be get as an argument.

thanks.

+2  A: 

Why don't you just zip (or any other archive method: tar, 7z,...) them together?

Let_Me_Be
Why the the down-vote? This is the most sensible approach.
Let_Me_Be
+1  A: 

Uhm,... I think what you want to do is store two files in one and then extract both files from that one, but please do correct me if I misunderstood.

You could just use zips (gzip, 7zip, whatever) with no compression. If you want to code it yourself, you can store the following information in a file:

offset 0 - 3: a 4-byte integer with the length of the first file.
offset 4 - 7: a 4-byte integer with the length of the second file.
offset 8+: the first file, followed by the second file.

If you need help doing that, ask away!

Santiago Lezica