title: OpenSSL "No Shared cipher"
body: <p>I know there is a barrage of questions (and answers) but I couldn't find one that moved me on...</p>
  <p>I am trying to create an SSL client/server app and getting:</p>
  <blockquote>
  <p>SSL_accept() returned -1</p>
  <p>Error in SSL_accept(): 1</p>
  <p>Error: error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher</p>
  </blockquote>
  <p>I really don't understand what I have done wrong :(</p>
  <p>Both call before any OpenSSL call</p>
  <p>SSL_load_error_strings();</p>
  <p>SSL_library_init();</p>
  <p>ERR_load_BIO_strings();</p>
  <p>OpenSSL_add_all_algorithms();</p>
  <p>Server (snipped to make shorter):</p>
  <pre><code>&lt;Created socket and set it to listen to port 8888&gt;
  
  &lt;Bind and make it listen&gt;
  
  while (1) 
  {
      client = accept( server, (sockaddr*) &amp;clientsockaddrin, &amp;len );
  
      SSL_CTX *ctx = SSL_CTX_new( SSLv3_server_method() );
  
      BIO* bio = BIO_new_file( &quot;dh1024.pem&quot;, &quot;r&quot; );
  
      DH* ret = PEM_read_bio_DHparams( bio, NULL, NULL, NULL );
  
      BIO_free( bio );
  
      SSL_CTX_set_tmp_dh( ctx, ret );
  
      RSA* rsa = RSA_generate_key( 1024, RSA_F4, NULL, NULL );
  
      SSL_CTX_set_tmp_rsa( ctx, rsa );
  
      SSL_CTX_set_cipher_list( ctx, &quot;ALL&quot; );
  
      SSL* ssl = SSL_new(ctx);
  
      BIO* sslclient = BIO_new_socket(client, BIO_NOCLOSE);
  
      SSL_set_bio(ssl, sslclient, sslclient);
  
      int r = SSL_accept( ssl );
  
      if (r != 1) 
      {
          printf(&quot;SSL_accept() returned %d\n&quot;, r);
          printf(&quot;Error in SSL_accept(): %d\n&quot;, SSL_get_error(ssl, r));
          char error[65535];
          ERR_error_string_n(ERR_get_error(), error, 65535);
          printf(&quot;Error: %s\n\n&quot;, error);
          ERR_print_errors(sslclient);
          int err = WSAGetLastError();
          printf(&quot;WSA: %d\n&quot;, err);
          // We failed to accept this client connection.
          // Ideally here you'll drop the connection and continue on.
          break;
      }
  }
  </code></pre>
  <p>Client is:</p>
  <pre><code>SSLSocket *sslSocket = NULL;
  SSL_CTX *ctx = NULL;
  
  ctx = SSL_CTX_new( SSLv3_client_method() );
  
  adaptor-&gt;SetCipherList( ctx, std::string( &quot;ALL&quot; ) );
  
  sslSocket = static_cast&lt;SSLSocket *&gt;( adaptor-&gt;Connect( ctx, &quot;localhost&quot;, 8888 ) );
  
  if ( sslSocket == NULL )
  {
      std::cout &lt;&lt; &quot;Unable to connect to service... aborting!&quot; &lt;&lt; std::endl;
      return;
  }
  </code></pre>
  <p>I have spent days pulling (whats left of my hair) out, so any help would be gratefully accepted!!</p>