Hello Sir / Madam,

I am very much new to openssl programming. I want to make a TCP connection 
secure using openssl. I do not want to use any certificate or keys.. Is it 
possible to make a TCP connection secure without using certificate or keys?? I 
am using openssl-0.9.7a.

To make a TCP connection secure I have changed two example files of the 
openssl-0.9.7a source code under demo/ssl. I am attaching those changed files 
with this email. I changed those files to avoid certificate and keys related 
openssl calls.. But server and client both are giving following errors.. Please 
please help..

In Server ...
Connection from 100007f, port 8fc0
SSL connection using (NONE)
7778:error:140EC0E5:SSL routines:SSL2_READ_INTERNAL:ssl handshake 
failure:s2_pkt.c:143:


In Client ...
7779:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too 
long:asn1_lib.c:138:
7779:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object 
header:tasn_dec.c:928:
7779:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 
error:tasn_dec.c:304:Type=X509
7779:error:1407E00B:SSL routines:SSL2_SET_CERTIFICATE:X509 lib:s2_clnt.c:1050:


Below are the openssl library calls made by the server..
  SSL_library_init();
  SSL_load_error_strings();
  SSLeay_add_ssl_algorithms();
  meth = SSLv23_server_method();
  ctx = SSL_CTX_new (meth);
  ssl = SSL_new (ctx);
  SSL_set_fd (ssl, sd);
  err = SSL_accept (ssl);        
  SSL_read (ssl, buf, sizeof(buf) - 1); 
  err = SSL_write (ssl, "I hear you.", strlen("I hear you."));
  SSL_free (ssl);
  SSL_CTX_free (ctx);


In client following calls are made...
  SSL_library_init();
  SSLeay_add_ssl_algorithms();
  meth = SSLv2_client_method();
  SSL_load_error_strings();
  ctx = SSL_CTX_new (meth);   
  ssl = SSL_new (ctx); 
  SSL_set_fd (ssl, sd);
  err = SSL_connect (ssl);  
  err = SSL_write (ssl, "Hello World!", strlen("Hello World!"));  CHK_SSL(err);
  err = SSL_read (ssl, buf, sizeof(buf) - 1); 
  SSL_shutdown (ssl);
  SSL_free (ssl);
  SSL_CTX_free (ctx);


Thanks
Subrata

Reply via email to