I'm using LWP to post data to a > https server. The Server needs the certificate for Authentication. I have the Cert.pfx certificate which is given for the installation on to the browser. Using Openssl I could get the privatekey.pem and publickey.pem from the cert.pfx. I used the following commands to do that openssl pkcs12 -in CERT.pfx -clcerts -out certonly.pem -nokeys openssl pkcs12 -in CERT.pfx -clcerts -out keys.pem openssl rsa -in keys.pem -pubout -out pubkey.pem -text openssl rsa -in keys.pem -pubout -out pubkey.pem openssl rsa -in keys.pem -pubin -text >private.key openssl rsa -pubout <keys.pem >public.key Now In my perl script I used the following code. use LWP::UserAgent; use HTTP::Cookies; #for testing use LWP::Debug '+'; $cookie = new HTTP::Cookies( ignore_discard => 1 ); $ua = new LWP::UserAgent; $ENV{https_proxy}="2342xxxxx:80"; $ua->proxy(http => $ENV{"HTTP_Proxy"}) if $ENV{"HTTP_Proxy"}; $ua->cookie_jar( $cookie ); $ua->agent("Mozilla/8.0"); #get the cookie $ENV{HTTPS_VERSION} = '3'; $ENV{HTTPS_CERT_FILE} = '/certs/certonly.pem'; $ENV{HTTPS_KEY_FILE} = '/certs/keysnopass.pem'; #####$ENV{HTTPS_CA_FILE} = "some_file"; #####$ENV{HTTPS_CA_DIR} = "some_dir"; $request = new HTTP::Request('GET', 'https:///'); $res = $ua->request( $request ); if ($res->is_success) { print "Success\n"; print "As_string: ", $res->as_string, "\n"; } else { print "FAILED: ", $res->code, " ", $res->message, "\n"; } But the server is not able to authnticate. I guess its looking for $ENV{HTTPS_CA_FILE} and $ENV{HTTPS_CA_DIR}. I don't know what to pass to these variables. Can you please advice me on this. I have the Cert.pfx file. How do I make the CA_file etc. Please suggest me on this.Let me know if I am doing some thing wrong. Thanks in advance. Regards, Kris

In reply to Re: Re: how to do https connects using client authentication by k_r_i_s_117
in thread how to do https connects using client authentication by k_r_i_s_117

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.