Simon Fell > Its just code > WM5.0 SSL wrapup
Tuesday, July 18, 2006WM5.0 SSL wrapup
Following up on this & this, I got to the bottom of the SSL problems on Windows Mobile 5.0. The docs are delightfully short on details, all they say is call WSAIoctl with the SO_SSL_PERFORM_HANDSHAKE control code passing in the target server name. none of the docs I could find actually explain the details of how you pass this server name in, (neither do the CE 4.2 docs, when this server name passing was introduced), back when CE4.2 came out, i changed PocketHTTP to do
This appeared to work, the call suceeded, the SSL connection gets established correctly, all is good and well. It turns out that on WM5.0, you need to pass in the length of the server name including the terminating NULL, either this is a change, or it seems more likely to me, the serverName stuff was added to the CE 4.2 docs, but was never implemented, now its implemented in WM5.0 it barfs. I never would of found the include the NULL in the length, its not mentioned in any MSDN docs I could fine, but I took a hint from this post on using the new SET_PEER_NAME option. So PocketHTTP, now does this
WSAIoctl( t->socket, SO_SSL_PERFORM_HANDSHAKE, (void *)(serverName), strlen(serverName), 0, 0, NULL, NULL, NULL )
and all is well, this works fine on WM5.0, and despite all the signs that you need to use VS.NET 2005 to do WM5.0 builds, the latest PocketHTTP build is still done with eVC3, and it works fine on my WM5.0 device. PocketHTTP v.1.3.0 is out and has this fix in it.
WSAIoctl( t->socket, SO_SSL_PERFORM_HANDSHAKE, (void *)(serverName), strlen(serverName)+1, 0, 0, NULL, NULL, NULL )
You can't post a Comment
Sorry i got sick of comment spam, have something to say about one of my posts, post it to your own weblog.