in reply to io::socket and encrypt

Good idea!

So good, in fact, that IO::Socket::SSL does exactly that :)

You might want to consider using that module, since its security is likely to be better than what you come up with yourself, given how many gotchas there are in writing secure comm code.
--
Mike