title: OpenSSL TLS/DTLS PSK
body: <p>I'm working on an application where Key Server (K) generates a symmetrical key and shares it with Server(A) and Client(B). A and B connects via UDP.
  I'm using Memory BIOs, and was trying to use Cipher "PSK-AES128-CBC-SHA".</p>
  
  <p>I have few questions related to this:</p>
  
  <ol>
  <li>When we have a symmetrical key should we still call SSL_do_handshake ?</li>
  <li>When I set the Cipher with this call <code>SSL_CTX_set_cipher_list(context, "PSK-AES128-CBC-SHA");</code> I get an error <code>SSL routines:ssl_cipher_list_to_bytes:no ciphers available</code></li>
  </ol>
  
  <p>I tried using TLSV1_2_server_method, TLSV1_2_server_method, DTLS_server_method, DTLS_client_method but every method failed with the above error.</p>
  
  <p>Is there any example code available for TLS-PSK encryption ? I couldn't find any good tutorial or example online. </p>
  
  <p>I was referring to this article while doing this, but instead i'm using Memory BIOs
  <a href="https://bitbucket.org/tiebingzhang/tls-psk-server-client-example/src/783092f802383421cfa1088b0e7b804b39d3cf7c/psk_server.c?at=default&amp;fileviewer=file-view-default" rel="nofollow noreferrer">https://bitbucket.org/tiebingzhang/tls-psk-server-client-example/src/783092f802383421cfa1088b0e7b804b39d3cf7c/psk_server.c?at=default&amp;fileviewer=file-view-default</a></p>