Wireshark-users: Re: [Wireshark-users] SSL decrypter pre master secret handling
From: Sake Blok <sake@xxxxxxxxxx>
Date: Fri, 17 Aug 2012 23:17:09 +0200
On 17 aug 2012, at 22:33, Wayne Blacklock wrote:
On Fri, Aug 17, 2012 at 4:19 PM, Sake Blok <sake@xxxxxxxxxx> wrote:
On 16 aug 2012, at 20:20, Wayne Blacklock wrote:

When everything isn't ok, the SSL decryption fails:

ssl_decrypt_pre_master_secret:RSA_private_decrypt
pcry_private_decrypt: stripping 146 bytes, decr_len 255
decrypted_unstrip_pre_master[255]:
<snip>
ssl_decrypt_pre_master_secret wrong pre_master_secret length (109, expected 48)
dissect_ssl3_handshake can't decrypt pre master secret

Now I am no SSL expert, but I don't think this is right. What I hope to understand and the reason for this post, is how exactly the byte stripping works... where does the SSL decrypter  get 146 from and could this explain our SSL issues? If so, what exactly is going wrong? I've had a bit of a look through the TLS spec but it isn't clear to me and so I would appreciate any and all advice.

The only situations where I have seen the message "wrong pre_master_secret length" were when the public key in the server certificate did not match the provided private key. Can you verify that the *exact* same certificate is used in both sessions?

So I suppose this is my next question. We're using a Java based implementation. We have the root cert in our trust store. My understanding is the public key should come from the server during the SSL transaction and ServerHello right? We don't have the servers certificate in our key store, just the root cert so the key has to be coming from the server during the ServerHello.

To be more precise, the Public Key is part of the server Certificate which is sent to the client in the SSL Handshake message "Cerfificate", this message comes after the ServerHello, but as TCP is a streaming protocol, the (start of the) Certificate handshake message is often in the same packet as the ServerHello.

I have compared good and bad transactions at the packet SSL level and I can see no differences (except for the secrets). The key coming from the server is the same.

Are you able to share (handshake messages of) the good and bad SSL traces? 

Cheers,
Sake