Have you thought about just using one of the Curl modules?
In reply to Re: ssl client authentication by zentara in thread ssl client authentication by perlnewbie9292