21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter CHAPTER 9 9<br />

Networking<br />

Today, most applications perform some type of network activity. Unfortunately,<br />

many programmers don’t know how to access a network securely. The recipes in this<br />

chapter aim to help you use a network in your application. To many developers, network<br />

security from the application standpoint means using the Secure Sockets Layer<br />

(SSL), but SSL isn’t a magic solution. SSL can be difficult to use properly; in many<br />

cases, it is overkill, and in a few cases, it is insufficient. This chapter presents recipes<br />

for using OpenSSLto build SSL-enabled clients and servers and recipes for network<br />

and interprocess communication without SSL.<br />

On the Windows platform, with the exception of SSLover HTTP (which we cover in<br />

Recipe 9.4), we’ve chosen to limit the SSL-specific recipes to OpenSSL, which is<br />

freely available and portable to a wide range of platforms, Windows included.<br />

On Windows systems, Microsoft provides access to its SSLimplementation through<br />

the Security Support Provider Interface (SSPI). SSPI is well documented, but unfortunately,<br />

the use of SSLis not. What’s more unfortunate is that implementing an SSLenabled<br />

client or server with SSPI on Windows is considerably more complex than<br />

using OpenSSL(which is saying quite a lot). The SSPI interface to SSLis surprisingly<br />

low-level, requiring programs that use it to do much of the work of exchanging protocol<br />

messages themselves. Because SSLis difficult to use properly, it is desirable to<br />

mask protocol details with a high-level implementation (such as OpenSSL). We<br />

therefore avoid the SSPI interface to SSL altogether.<br />

If you are interested in finding out more about SSPI and the SSLinterface, we recommend<br />

that you consult the Microsoft Developer’s Network (MSDN) and the samples<br />

that are included with the Microsoft Windows Platform SDK, which is available<br />

from Microsoft on the Internet at http://www.microsoft.com/msdownload/platformsdk/sdkupdate/.<br />

The relevant example code can be found in the directory<br />

Microsoft SDK\Samples\Security\SSPI\SSL from wherever you install it on your system<br />

(normally in \Program Files on your boot drive).<br />

454<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!