Hi,
My structure has 3 unsigned char arrays and I will have to move this
encrypted data to other machines too.
Following is the structure:
typedef struct myStruct {
unsigned char id[4];
unsigned char type;
unsigned char Data[128]; } ;
Can you please let me know how do I serialize that is unambiguous?
I tried,
struct myStruct* mypointer;
> mypointer = .... a pointer to your struct
> RSA_public_encrypt( sizeof *mypointer, mypointer,...)
But I get warning that I am passing incompatible format. I believe I can
send only unsigned char * to RSA_public_encrypt.
Thanks,
Jayashree
On Tue, 3 Aug 2004, Rich Salz wrote:
> > I am trying to use openssl to encrypt a "c structure" instead of just a
> > "string", is there any function in openssl that I could use?
>
> No. You will have to do some work. The amount of work you will have
> to do depends on the details of the data and where you are using it.
> For example, Are you moving the data from one machine to another
> machine, possibly of a different type? You will have to serialize.
> Does your structure have any pointers in it? You will have to
> serialize.
>
> If you *do not* have to serialize, than you can probably do something
> very simple:
> struct mystruct* mypointer;
> mypointer = .... a pointer to your struct
> RSA_public_encrypt(...., mypointer, sizeof *mypointer, ...)
>
> If you *do* have to serialize, than you will have to do something like
> sprintf your structure into a temporary buffer, and encrypt that.
> Then, later on, you decrypt the buffer, and reverse the serialization.
> This means you need to define a serialization format that is unambiguous.
> How you do that depends on the details of your data.
>
> Hope this helps.
> /r$
> --
> Rich Salz Chief Security Architect
> DataPower Technology http://www.datapower.com
> XS40 XML Security Gateway http://www.datapower.com/products/xs40.html
> XML Security Overview http://www.datapower.com/xmldev/xmlsecurity.html
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]