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;
>
> 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.
>
> if (!retval)
> return (-1);
> printf ("Session len : %d value : %s\n", retval, buf);
>
Here, prepare another
p = &buf;
and it should work.
> new_session = d2i_SSL_SESSION (&new_session, &p, retval);
>
Just been there myself. If you check carefully the code within
PEM_write_SSL_SESSION (now knowing what to look for), you will find out
the same :-)
Best regards,
Lutz
--
Lutz Jaenicke [EMAIL PROTECTED]
BTU Cottbus http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]