title: Parsing ServerKeyExchange message in SSL
body: <p>I'm building a Java parser to read and handle SSL Handshake message. Per<a href="https://www.rfc-editor.org/rfc/rfc5246" rel="nofollow noreferrer">ietf spec</a>, the ServerKeyExchange message is represented as follows:</p>
  <pre><code>struct {
        select (KeyExchangeAlgorithm) {
            case dh_anon:
                ServerDHParams params;
            case dhe_dss:
            case dhe_rsa:
                ServerDHParams params;
                digitally-signed struct {
                    opaque client_random[32];
                    opaque server_random[32];
                    ServerDHParams params;
                } signed_params;
            case rsa:
            case dh_dss:
            case dh_rsa:
                struct {} ;
               /* message is omitted for rsa, dh_dss, and dh_rsa */
            /* may be extended, e.g., for ECDH -- see [TLSECC] */
        };
    } ServerKeyExchange;
  </code></pre>
  <p>..whereas the ServerDHParams is defined as follows:</p>
  <pre><code>struct {
     opaque dh_p&lt;1..2^16-1&gt;;
     opaque dh_g&lt;1..2^16-1&gt;;
     opaque dh_Ys&lt;1..2^16-1&gt;;
  } ServerDHParams;     /* Ephemeral DH parameters */
  </code></pre>
  <p>Now when I use the wireshark to look at a sample trace containing an instance of Server Key Exchange, I see a format that does not fit the definition above:</p>
  <p><a href="https://i.stack.imgur.com/mneo7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mneo7.png" alt="Screenshot from wireshark" /></a></p>
  <p>How can I use the ietf definition to parse such a Server Key Exchange message?</p>