blackchicken has asked for the wisdom of the Perl Monks concerning the following question:

I need to write a program that posts an https request and stores the result. The server I am posting to requires client authentication using certificates. Basically, I need to know how to pass my certificate to the server as well as validate the server's certificate.

I have been looking through the LWP stuff on CPAN, but have not seen anything that addresses client certificates.

Any help would be greatly appreciated.

  • Comment on HTTPS request with client authentication using certificates

Replies are listed 'Best First'.
Re: HTTPS request with client authentication using certificates
by kwaping (Priest) on Jan 22, 2007 at 18:54 UTC
    Check out the docs for Net::SSLeay, it appears this module can handle those tasks.

    ---
    It's all fine and dandy until someone has to look at the code.
Re: HTTPS request with client authentication using certificates
by glasswalk3r (Friar) on Jan 22, 2007 at 19:01 UTC

    I cannot avoid to ask... but requesting a certificate from a client is quite strange in a HTTPS request.

    Are you positive about this authentication method? I honest don't know any that works like that.

    For HTTPS requests, the server will send an certificate that your client may accept or not.

    Anyway... here is something that may help you (or not, since I completetly clueless about this authentication schema of yours): http://www-128.ibm.com/developerworks/linux/library/wa-perlsecure.html

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Re: HTTPS request with client authentication using certificates
by Popcorn Dave (Abbot) on Jan 22, 2007 at 23:53 UTC
    The easiest thing to do would be to check with your provider on how they do it. My provider, Hurricane Electric, has certificates for their customer's use so they use the suid method of calling. YMMV, so it's best to check with your ISP.

    Revolution. Today, 3 O'Clock. Meet behind the monkey bars.

    If quizzes are quizzical, what are tests?

Re: HTTPS request with client authentication using certificates
by brycen (Monk) on Jan 22, 2007 at 20:09 UTC
    You may be making this harder than you need to. Just because a server presents you with a certificate does not necessarily mean you have to do anything with it. You may need to explain more about the unusual server you seem to be dealing with.

    When sucking data from http or https servers, I typically use the 'wget' command line tool. This tool handles standard auth login. While it is not a OS-Independent or Pure-Perl solution, but it sure gets the job done with ease.

Re: HTTPS request with client authentication using certificates
by bingos (Vicar) on Jan 23, 2007 at 14:55 UTC

    According to the LWP README.SSL , one may either use Crypt::SSLeay or IO::Socket::SSL to support SSL, though the former is recommended.

    The Crypt::SSLeay documentation has this to say about how to use client certificates which may or may not be of use to you.