n client side
>  
>  // store ssl session info to buf
>  if(session)
>  {
>   nsessionLen = i2d_SSL_SESSION(session, NULL);
>   //
>   if(nsessionLen > 0)
>   {
>    unsigned char* p = NULL;
>    sessionbuf = (unsigned
> char*)OPENSSL_malloc(nsessionLen);
>    p = sessionbuf;
>    i2d_SSL_SESSION(session, &p);
>   }
>  }
>
>  // restore session from buf
>
>  if(sessionbuf)
>  {
>   unsigned char *p = sessionbuf;
>   session = SSL_SESSION_new();
>
>   session = d2i_SSL_SESSION(&session, &p, nsessionLen);
>  
>   SSL_set_session(ssl, session);
>   SSL_SESSION_free(session);
>   session = NULL;
>  }
>
>
 

i have the same problem. and did not know why?
 
-----????-----
???: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]?? Aslam
????: 2001?8?30? 3:56
???: '[EMAIL PROTECTED]'
??: RE: Session Resumption.. d2i_SSL_SESSION() function..
 

Hi,
 
ya I did that, prior to i2d_SSL_SESSION(), SSL_SESSION_print() prints the
textual description of the cipher. But after doing i2d_SSL_SESSION() and
d2i_SSL_SESSION() it just prints the cipher_id, not the textual cipher
representation. I went inside the i2d_SSL_SESSION() code and found that
pSession->cipher=NULL and pSession->cipher_id is actualy read from ASN1
object. And this looks fine to me.
 
But in the SSL_connect() code, when client is checking for the returned
cipher from server in sever_hello, openssl does following:
 
 if (s->hit && (s->session->cipher != c))
  {
  if (!(s->options &
   SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG))
   {
   al=SSL_AD_ILLEGAL_PARAMETER;
 
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);
   goto f_err;
   }
  }
 
My question is how come above thing work when d2i_SSL_SESSION() is
explicitly making pSession->cipher=NULL ???? Cause when u set the old
session for a new SSL*, u just do a SSL_set_session(), which does nothing
except a pointer assignment.. then at which point I sould get a
pSSL->session->cipher pointer ???
 
Thanks
 
Aslam
 
 
 
 
 

-----Original Message-----
From: Lutz Jaenicke [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 3:36 PM
To: '[EMAIL PROTECTED]'
Subject: Re: Session Resumption.. d2i_SSL_SESSION() function..
 

On Wed, Aug 29, 2001 at 01:54:38PM -0400, Aslam wrote:
> I'm doing session resumption on client side. For this of the previous
> session I did a i2d_SSL_SESSION() and in this session, I'm setting this
> SSL_SESSION ptr, which I obtained from d2i_SSL_SESSION().
> Now the problem is when I do a d2i_SSL_SESSION() to get the SSL_SESSION
ptr,
> the ptr->cipher is NULL, and in SSL_connect code this cipher is checked
> against the cipher retured from the server.. following code in
> ssl\s3_clnt.c..
 
If you did save a valid session, the cipher information was stored inside
the ASN1 object. When you read it back, everything should be back in
order. Please use the (not yet documented) SSL_SESSION_print()
or SSL_SESSION_print_fp() command. Its use should be obvious from the
interface:
int SSL_SESSION_print_fp(FILE *fp, SSL_SESSION *x);
int SSL_SESSION_print(BIO *bp, SSL_SESSION *x);
(source is in openssl/ssl/ssl_text.c, example in openssl/apps/sess_id.c)
 
Best regards,
 Lutz
-----ԭʼÓʼþ-----
·¢¼þÈË: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]´ú±í Rahul S
·¢ËÍʱ¼ä: 2001Äê11ÔÂ2ÈÕ 4:47
ÊÕ¼þÈË: [EMAIL PROTECTED]
Ö÷Ìâ: d2i_SSL_SESSION problem

  Hi,
     I am using  use i2d_SSL_SESSION() and d2i_SSL_SESSION() at my server application as part of my testing.
  And the call to d2i_SSL_SESSION is failing . I am wondering whether I am doing the things corrrectly.
  Can anybody pls help me find what the problem would have been.


 

  SSL_SESSION *session,reconstructedSession ;

  unsigned char * asnsession;

  int  sessionLen;

  ------------------------------------------
  After handshake is done I do the follwing: 
  ------------------------------------------

  session=SSL_get1_session(ssl);

  /* I checked for session . It is not NULL */

  asnsession=(unsigned char *)malloc(i2d_SSL_SESSION(session,(unsigned char **)NULL));
 
  sessionLen=i2d_SSL_SESSION(SSL_get1_session(ssl),&asnsession);
 
  /* I checked for  sessionLen and asnsession . They are neither 0 nor NULL */
 
  reconstructedSession = d2i_SSL_SESSION(&reconstructedSession ,&asnsession,sessionLen);

  The function d2i_SSL_SESSION is resulting in an error :


   15376:error:0D067007:asn1 encoding routines:ASN1_COLLATE_PRIMITIVE:expecting an asn1 sequence:ssl_asn1.c:221:address=135194107 offset=0


 
 

Thanks,
S.Rahul



Do You Yahoo!?
Make a great connection at Yahoo! Personals.

Reply via email to