NAME

POE::Component::SSLify - Makes using SSL in the world of POE easy!

SYNOPSIS

Client-side usage

# Import the module
use POE::Component::SSLify qw( Client_SSLify );

# Create a normal SocketFactory wheel or something
my $factory = POE::Wheel::SocketFactory->new( ... );

# Converts the socket into a SSL socket POE can communicate with
eval { $socket = Client_SSLify( $socket ) };
if ( $@ ) {
	# Unable to SSLify it...
}

# Now, hand it off to ReadWrite
my $rw = POE::Wheel::ReadWrite->new(
	Handle	=>	$socket,
	...
);

# Use it as you wish...

Server-side usage

# !!! Make sure you have a public key + certificate generated via Net::SSLeay's makecert.pl

# Import the module
use POE::Component::SSLify qw( Server_SSLify SSLify_Options SSLify_GetCTX );

# Set the key + certificate file
eval { SSLify_Options( 'public-key.pem', 'public-cert.pem' ) };
if ( $@ ) {
	# Unable to load key or certificate file...
}

# Ah, I want to set some options ( not required )
# my $ctx = SSLify_GetCTX();
# Net::SSLeay::CTX_set_options( $ctx, foo );

# Create a normal SocketFactory wheel or something
my $factory = POE::Wheel::SocketFactory->new( ... );

# Converts the socket into a SSL socket POE can communicate with
eval { $socket = Server_SSLify( $socket ) };
if ( $@ ) {
	# Unable to SSLify it...
}

# Now, hand it off to ReadWrite
my $rw = POE::Wheel::ReadWrite->new(
	Handle	=>	$socket,
	...
);

# Use it as you wish...

ABSTRACT

Makes SSL use in POE a breeze!

CHANGES

0.03

First stab at the server-side code, help me test it out!
Refactored SSLify() into client/server side, so update your program accordingly!

0.02

Made sure the IO::Handle way was used only on MSWin32

0.01

Initial release

DESCRIPTION

This component represents the standard way to do SSL in POE.

NOTES

Dying everywhere...

This module will die() if Net::SSLeay could not be loaded or it is not the version we want. So, it is recommended that you check for errors and not use SSL, like so:

eval { use POE::Component::SSLify };
if ( $@ ) {
	$sslavailable = 0;
} else {
	$sslavailable = 1;
}

# Make socket SSL!
if ( $sslavailable ) {
	eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) };
	if ( $@ ) {
		# Unable to SSLify the socket...
	}
}

FUNCTIONS

There's four functions one can use:

Client_SSLify

Accepts a socket, returns a brand new socket SSLified

Server_SSLify

Accepts a socket, returns a brand new socket SSLified

NOTE: SSLify_Options must be set first!

SSLify_Options

Accepts the location of the SSL key + certificate files and does it's job

SSLify_GetCTX

Returns the server-side CTX in case you wanted to play around with it :)

EXPORT

Stuffs all the 4 functions in @EXPORT_OK so you have to request them directly

SEE ALSO

POE

Net::SSLeay

AUTHOR

Apocalypse <apocal@cpan.org>

PROPS

	Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply
	packaged up the code into something everyone could use and accepted the burden
	of maintaining it :)

	From the PoCo::Client::HTTP code =]
	# TODO - This code should probably become a POE::Kernel method,
    	# seeing as it's rather baroque and potentially useful in a number
    	# of places.

COPYRIGHT AND LICENSE

Copyright 2004 by Apocalypse/Rocco Caputo

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.