At 10:02 08.03.00 +0100, you wrote:
>On Tue, Mar 07, 2000 at 05:22:55PM -0800, Seetharama Sarma Ayyadevara wrote:
>> If I run this I am getting this error
>> 
>> ERROR : error:0D067007:asn1 encoding
>> routines:ASN1_COLLATE_PRIMITIVE:expecting an asn1 sequence
>> 
>> Session len : 119 value : 0u
>> 
>>     Can any one throw some light on what I am doing wrong.
>> 
>> int foo (SSL_SESSION * ssl_session)
>> {
>>     char  buf1[1024], buf [1024 * 10], *p;
>>     int retval;
>>     SSL_SESSION * new_session;
>> 
>>     memset ((void *)buf, '\0', 1024 * 10);
>>     p = &buf;

I thtink that should be
   p = buf;
p and buf are pointer to char (but buf has some valid data assigned...)

>>      retval = i2d_SSL_SESSION (ssl_session, &p);
>
>Here, you path "p" to retval called by reference. I don't know why this
>is done, but "p" is altered during the call, such that after the
>i2d_SSL_SESSION p!=&buf.
Because p is a moving pointer, so you can convert more than one
element:
retval = i2d_SSL_SESSION (ssl_session1, &p);
retval = i2d_SSL_SESSION (ssl_session2, &p);
...

>>      if (!retval)
>>          return (-1);
>>      printf ("Session len : %d value : %s\n",  retval, buf);
buf contains binary data (DER encoded session data),
printing it to terminal won't produce human rewadable data...

>Here, prepare another
>       p = &buf;
>and it should work.
and again
   p = buf;

>>      new_session = d2i_SSL_SESSION (&new_session, &p, retval);

By

Goetz

-- 
Goetz Babin-Ebell, TC TrustCenter GmbH, http://www.trustcenter.de 
Sonninstr. 24-28, 20097 Hamburg, Germany
Tel.: +49-(0)40 80 80 26 -0,  Fax: +49-(0)40 80 80 26 -126
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to