SPUG: Using Perl to post data via SSL with client certificate authentication

Ron Pero spug at magnadev.com
Fri May 28 00:28:45 CDT 2004

Net::SSLeay is tripping me up on something simple, and I would
really appreciate a tip from someone that knows how to use perl to post data
via an SSL
connection using a client certificate for authentication.

Basically, using sample code from the documentation, I get an error that I
am calling the post_https function with too many arguments.

Here are the pretty details.

Using the example code from the documentation section, Using Client
Certificates, I get this apache error:
Too many arguments for Net::SSLeay::post_https at myscript.cgi line 446,
near "$path_to_key8)"
Execution of relay_response.cgi aborted due to compilation errors.
[Wed May 26 16:41:57 2004] [error] [client] Premature end of
script headers: myscript.cgi

This is the sample code:
($page, $response, %reply_headers)
         = post_https('www.bacus.pt', 443, '/foo.cgi',           # 3b
              make_headers('Authorization' =>
                           'Basic ' .
              make_form(OK   => '1', name => 'Sampo'),
              $mime_type6, $path_to_crt7, $path_to_key8);

This is what mine looks like:
my $mime_type6 = 'text/xml';
my $path_to_crt7 = '/my/path/mycert.der';
my $path_to_key8 = '/my/path/mykey1024.pem';
use Net::SSLeay qw(post_https);
my ($page, $response, %reply_headers) = post_https('partners.somewhere.com',
443, '/s/MyXml?pid=12345&pacct=My_Acct', '', $xml_text, $mime_type6,
$path_to_crt7, $path_to_key8);

Documentation bug? Or something else?

Thank you,


More information about the spug-list mailing list