title: How to debug a TLS implementation
body: <p>I am writing a TLS implementation and have been stuck at the server finished message for weeks now. Openssl s_client give sthe error:</p>
  
  <blockquote>
    <p>5820:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or
    bad record mac:.\ssl \s3_pkt.c:483:</p>
  </blockquote>
  
  <p>which is not very helpful because I cannot trace anything wrong to the MAC or the encryption process.<br>
  Chrome gives the error:</p>
  
  <blockquote>
    <p>5820:error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or
    bad record mac:.\ssl \s3_pkt.c:483:</p>
  </blockquote>
  
  <p>while Firefox says:</p>
  
  <blockquote>
    <p>Cannot communicate securely with peer: no common encryption
    algorithm(s). (Error code: ssl_error_no_cypher_overlap)</p>
  </blockquote>
  
  <p>GNUtls-debug is even worse</p>
  
  <blockquote>
    <p>error in the pull function.</p>
  </blockquote>
  
  <p>I have narrowed down the suspect list to either a wrong des3/aes256 implementation(the only ones I've tried so far) or bad MAC, but I cannot be sure, and have been over the code for what feels like a thousand times with no luck of spotting anything evil going on.<br>
  <strong>Questions</strong><br>
  Is there any way to get any browser to give a full and detailed SSL error? All I need is a detailed and reliable error message/debug log. 
  Are there any tools for debugging a TLS implementation?</p>