nmkhoa / unitt

Automatically exported from code.google.com/p/unitt
0 stars 0 forks source link

TLS delegate missing #48

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1) I have built from Unitt sources in order to debug my secure web socket 
iphone application. I notice that WebSocket.m is missing the required 
AsyncSocket delegate ...

/**
 * Called after the socket has successfully completed SSL/TLS negotiation.
 * This method is not called unless you use the provided startTLS method.
 * 
 * If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,
 * and the onSocket:willDisconnectWithError: delegate method will be called with the specific SSL error code.
 **/
- (void)onSocketDidSecure:(AsyncSocket *)sock
{
    [self onSocket:sock didSecure:TRUE];
}

2) However, after the wss socket is properly opened with a TLS handshake, I get 
a server error on the first client data write. The client writes 202 bytes, the 
server receives 272 bytes and the method authentication code fails on the 
server. I see my client data in the server trace, but it has 8 bytes of garbage 
pre-pended.

Earlier I tried the SocketRocket library with the same results on the server - 
bad MAC after a good handshake. My android version of the Unitt client works 
great.  

I can debug as far as CFWriteStreamWrite(...) in AsyncSocket doSendBytes - 
which reports that 202 client data bytes indeed get written. But I am at a loss 
as to how to debug further. Somewhere, the iOS TLS framework is corrupting my 
client data during the send - I think. 

Original issue reported on code.google.com by stephenl...@gmail.com on 30 Jun 2012 at 2:58

GoogleCodeExporter commented 8 years ago
method authentication code --> message authentication code

Original comment by stephenl...@gmail.com on 30 Jun 2012 at 3:19

GoogleCodeExporter commented 8 years ago
Please remove this issue. I was able to get an test adapted from the test suite 
to work OK against wss://echo.websocket.org. The error must be within my own 
application.

Note that I built sources from the 1.0.0-RC tag and had to update 
WebSocketFragment from the trunk in order to compile OK.

Original comment by stephenl...@gmail.com on 30 Jun 2012 at 9:03

GoogleCodeExporter commented 8 years ago
I changed the delegate method. Thank you for catching that.

Original comment by joshuadmorris@gmail.com on 6 Jul 2012 at 5:57