No one replied to my question, so perhaps I'm trying to do the wrong thing.


I'd like to store some text string in an initialization file. I'd like these to be
encrypted, so anyone browsing the file can't simply read them. I don't want
to encrypt the whole file, as there's plain text in it as well.


Then, I'd like to have an application decrypt the strings at run-time, so it can
use the plain text values.


So, I'd like to have a command line utility that I can give a plain text string
and password to; and a callable routine that I can call with an encrypted string
and a password.


Any suggestions for this?

Thanks.

- Lee




To: [EMAIL PROTECTED]
Subject: Command-line and API differences
Date: Thu, 12 Feb 2004 20:06:31 -0500

I'm having a problem using the crypto api interface, and the openssl command line

Here's my dumbed down example.   I can never get the command line to
return the plain text -- when invoked with the same password the code uses.
There must be something obvious that I'm doing wrong...

int main (int argc,  char *argv[])
{
   unsigned char       encBuf[8];
   char *              output = (char *)"out.enc";

   const char *        key =  "testtest";
   unsigned char       data[8] = {'s','o','m','e','d','a','t','a'};

   des_cblock          k;
   des_key_schedule    key_schedule;
   unsigned char       iv[8];

        string_to_key(key, (C_Block *) k);
   des_set_key(&k,key_schedule);

        des_ecb_encrypt(
       &data,
       &encBuf,
       key_schedule,
       1               );

        int out_file=open(output,O_WRONLY | O_CREAT, 0666);
   write(out_file, encBuf, 8 );
        close(out_file);
}


Then, I try to get the plain text back with:


/*

openssl enc -d -nosalt -des-ecb -in out.enc

*/


Thanks for any help.



_________________________________________________________________
Get some great ideas here for your sweetheart on Valentine's Day - and beyond. http://special.msn.com/network/celebrateromance.armx


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to