Hi David/Stefan,

Thanks for the reply.
The core of the problem was that after calling i2d_PUBKEY() issuer_pubkey
was pointing to end of the buffer.
Interesting part is why it was working [same pubkey data] all time in single
test program and not my application.
In single test program, issuer_pbukey was only malloc, so when I was dumping
issuer_pubkey, it was nothing but  common heap data which was same all the
time. While is my application the heap data was changing all the time, bcoz
of so many malloc() and free(), so issuer_pubkey was different in each run.
Thanks again.

Best Regards,
Raj



On Mon, Sep 13, 2010 at 3:22 PM, David Schwartz <dav...@webmaster.com>wrote:

> On 9/12/2010 11:38 PM, Raj Singh wrote:
>
>  issuer_pubkey_len = i2d_PUBKEY(pubKey, NULL);
>> issuer_pubkey = malloc(issuer_pubkey_len);
>> i2d_PUBKEY(pubKey, &issuer_pubkey);
>> memory_dump("issuer_pubkey", issuer_pubkey, issuer_pubkey_len);
>>
>> The problem, is issuer_pubkey buffer is different each time, I run the
>> my application using same code.
>>
>
> Umm, you forgot to save the original issuer_pubkey. After the call to
> i2d_PUBKEY, issuer_pubkey points elsewhere. Try:
>
>
> issuer_pubkey_len = i2d_PUBKEY(pubKey, NULL);
> issuer_pubkey = malloc(issuer_pubkey_len);
> foo=issuer_pubkey;
> i2d_PUBKEY(pubKey, &foo);
>
> memory_dump("issuer_pubkey", issuer_pubkey, issuer_pubkey_len);
>
> DS
>
>

Reply via email to