Re: how to encrypt a C data and write a bin file and read a bin at run time and decrypt C data



sweety wrote:
Dear All,

How to encrypt a C data file and make binary file and then have to read
a bin file at run time and decrypt the file and have to read the data.

Any help to achive this pls. Would be great if any sample source code
provided.

fopen() the file, in text or binary mode, as appropriate.
If your encryption algorithm depends on context w.r.t. the
input, read in the whole file (use either fread() or getc()
and malloc()/realloc() for the buffer).
Encrypt.
fopen() the output file in "b" binary mode. Write the output
to it. fclose() input and output file.

Essentially the same applies to the decryption part.

If you provide us with your best shot at it (minus the
encryption or decryption part), we may help you further
with the standard C part of it.
If you want some sort of dummy encryption/decryption for the
code you post, use a simple one, e.g. Caesar cipher.


Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
.



Relevant Pages

  • Re: Securing data to a process principal
    ... encryption key first time for the user - and use it later). ... secret. ... I need the decryption to ... You MAY think that instead of a filter driver you can simply ...
    (microsoft.public.platformsdk.security)
  • Re: embedded keys - there has to be a less vulnerable approach
    ... the database would be run on top of an encrypting file system ... > The use of an asymmetrical encryption algorithm does not seem to offer ... because the encryption and decryption ... > a hostile attacker is not a member of that small knowledgeable elite. ...
    (comp.security.misc)
  • embedded keys - there has to be a less vulnerable approach
    ... the database would be run on top of an encrypting file system ... The use of an asymmetrical encryption algorithm does not seem to offer ... because the encryption and decryption ... You have a table with customer names and addresses. ...
    (comp.security.misc)
  • NTE_BAD_DATA
    ... decryption module using the self signed certificate. ... My encryption and decryption module are as follows. ... goto Exit_MyDecryptFile; ... // imported from a BLOB read in from the source file or having ...
    (microsoft.public.platformsdk.security)
  • Re: How to Facilitate and Use Data Protection on DOM (WinCE 6.0)
    ... encryption on and off, while still having the filter load. ... Decryption in my file system filter seems to work fine but the 2nd ... FS filter is NOT APPLIED to Removable USB ... Hard Disk as well as the Removable USB media. ...
    (microsoft.public.windowsce.platbuilder)