qun-ying schrieb:
> 
> Hi,
> 
> I am trying to create a X509 certificate and store the result in a
> memory location for later usage. But the result return from i2d_X509()
> is wrong. I can get the correct result if I write the X509 structure
> through either PEM_write_X509() or i2d_X509_bio().

i2d_x509 modifies the 2nd argument.
 
> I am running OpenSSL 0.9.6 under Slackware 7.1 with gcc 2.95.2.
> 
> The process:
> X509 *x;
> char *buffer;

char *pcbuffer;

> int len;
> 
> ..... X509 contain a valid certificate
> len = i2d_X509(x, NULL);
> buffer = malloc(len);

pcBuffer = buffer;

> len = i2d_X509(x, &buffer);
> ...
> The result in buffer is not correct.

The result pointed to by pcBuffer is correct.

> Is anything wrong with the process?

-- 
Holger Reif                  Tel.: +49 361 74707-0
SmartRing GmbH               Fax.: +49 361 7470720
Europaplatz 5               [EMAIL PROTECTED]
D-99091 Erfurt                  WWW.Smarttrust.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to