[JDEV] Jabber SSL docs

Stephen Pendleton movsoftware at movsoftware.com
Wed Jul 31 08:12:57 CDT 2002


Adrian,

    SSL in the Jabber case is the same as any SSL connection. Here is some
Win32 code that you can use to establish a SSL socket:


nt
certificate_validation_procedure (DWORD dwType, LPVOID pvArg, DWORD
dwChainLen,
           LPBLOB pCertChain, DWORD dwFlags)
{
 return SSL_ERR_OKAY;
}

int
make_ssl_socket (int s)
{

 SSLVALIDATECERTHOOK hfunc;
 WSADATA WSAData;
 DWORD dwBytes, err;
 DWORD optval = SO_SEC_SSL;
 int buff[8192];
 DWORD dw = 0, ssl = SO_SEC_SSL;

 WSAStartup (MAKEWORD(1,1), &WSAData);

 if (setsockopt(s, SOL_SOCKET, SO_SECURE, (LPSTR)&optval, sizeof(optval)) <
0)
 {
  DWORD le = WSAGetLastError ();

  // Process any inserts in lpMsgBuf.
  // ...
  // Display the string.
  MessageBox( NULL, (LPCTSTR)L"Error Initializing SSL Library.", L"Error",
MB_OK | MB_ICONINFORMATION );


  return(-1);
 }


 //register certificate validation callback
 hfunc.HookFunc = certificate_validation_procedure;
 hfunc.pvArg = NULL;
 err = WSAIoctl(s, SO_SSL_SET_VALIDATE_CERT_HOOK, &hfunc, sizeof(hfunc),
&buff,
  8192, &dwBytes, NULL, NULL);

 if (SOCKET_ERROR==err)
 {
  DWORD le = WSAGetLastError ();

  // Display the string.
  MessageBox (NULL, (LPCTSTR)L"Error Initializing SSL Library.", L"Error",
MB_OK | MB_ICONINFORMATION );

  return -1;
 }

 ssl = SSL_FLAG_DEFER_HANDSHAKE;

 err = WSAIoctl (s, SO_SSL_SET_FLAGS, &ssl, sizeof ssl, &buff, 8192, &dw,
NULL, NULL );


 if (SOCKET_ERROR==err)
 {
  DWORD le = WSAGetLastError ();

  // Display the string.
  MessageBox (NULL, (LPCTSTR)L"Error Initializing SSL Library.", L"Error",
MB_OK | MB_ICONINFORMATION );

  return -1;
 }

 return s;
}

int
make_ssl_socket_connection (int s)
{
 return (WSAIoctl (s, SO_SSL_PERFORM_HANDSHAKE, 0, 0, 0, 0, 0, NULL, NULL));
}

  -----Original Message-----
  From: jdev-admin at jabber.org [mailto:jdev-admin at jabber.org]On Behalf Of
adrian
  Sent: Tuesday, July 30, 2002 4:29 AM
  To: jdev at jabber.org
  Subject: [JDEV] Jabber SSL docs


  hi...
  where can i find some docs about implementing SSL in a jabber client...?

  Adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.jabber.org/jdev/attachments/20020731/68dd4c6e/attachment-0002.htm>


More information about the JDev mailing list