cURL / Mailing Lists / curl-library / Single Mail

curl-library

JavaCurl problem calling url

From: Luis Cruz <lmpcruz_at_sapo.pt>
Date: Sun, 6 May 2007 14:28:24 +0100

Hi to all,

First of all, my apologizes for used the wrong mailing list.

About Daniel email... That was a test I was doing, and it should meant to be
on previous email.

If I only send this:

cg.setopt(CURL.OPT_SSLCERTTYPE, "PEM");
cg.setopt(CURL.OPT_SSLVERSION, 3);

I get the response I told on last mail, but if I add these lines:

cg.setopt(CURL.OPT_SSLCERT, "cert_name.pem"); // it's on the project folder
cg.setopt(CURL.OPT_SSLKEYPASSWD, "XXXXXXXXX");

I get a response like this:

------------------------------------------

* About to connect() to teste.mbnet.pt port 443
* Trying 195.138.0.178... * connected
* Connected to teste.mbnet.pt (195.138.0.178) port 443
* Closing connection #0

--------------------------------------------

Thanks in advanced for any suggestion,
Luis Cruz

-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: sábado, 5 de Maio de 2007 21:41
To: the curl tool
Subject: Re: JavaCurl problem calling url

On Sat, 5 May 2007, lmpcruz_at_sapo.pt wrote:

First, you should probably consider the curl-library mailing list since
you're
asking about libcurl details.

> cg.setopt(CURL.OPT_SSLCERT, ca_cert_file);

This sole line seems to indicate some kind of confusion or misunderstanding.

"SSLCERT" here refers to a client certificate, while a "ca cert" is a
certificate bundle that is used to verify peers with.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of lmpcruz_at_sapo.pt
Sent: sábado, 5 de Maio de 2007 14:40
To: curl-users_at_cool.haxx.se
Subject: JavaCurl problem calling url
Hi to all,
I have installed a Certificate on my computer, and when i try, in  
Browser, to reach this site:
https://teste.mbnet.pt/pvtn?A030=M002&A001=2796&C007=120060208024159&C013=79
59A85BD7A7B8F94FD0DC2D6BD92829B1B186B1&A061=10.50&A105=9782&A037=20070430105
929
i get this response:
------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<M999V01>
   <A030>M105</A030>
   <A001>2796</A001>
   <C007>120060208024159</C007>
   <C013 />
   <A037>20070430105929</A037>
   <A038>11</A038>
   <XA086>
     <A085>M005</A085>
     <A077>SIT.INCOMPATIVEL</A077>
     <A078>AUTORIZACAO</A078>
   </XA086>
</M999V01>
------------------------------------------
however, when i try to do this with JavaCurl (following CurlJ sample)  
i get this:
------------------------------------------
* About to connect() to teste.mbnet.pt port 443
*   Trying 195.138.0.178... * connected
* Connected to teste.mbnet.pt (195.138.0.178) port 443
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* 	 subject: /C=PT/O=MULTICERT-CA/OU=CERTIPOR -  
RA/OU=Corporate/OU=SIBS SA/OU=Web Server/CN=teste.mbnet.pt
* 	 start date: 2006-09-19 11:02:17 GMT
* 	 expire date: 2008-09-19 11:20:24 GMT
* 	 issuer: /C=pt/O=MULTICERT-CA/CN=MULTICERT-CA 02
* SSL certificate verify result: error number 1 (19), continuing anyway.
> GET  
>
/pvtn?A030=M005&A001=2796&C007=120060208024158&C013=&A061=10.50&A105=9782&C0
03=4088885000000118&C004=200912&C005=907&C042=0&C001=0  
> HTTP/1.1
Host: teste.mbnet.pt
Pragma: no-cache
Accept: */*
* Closing connection #0
--------------------------------------------
For what i saw, i guess JavaCurl don't accept P12 format, so i changed  
to PEM with OpenSSL with this:
openssl pkcs12 -clcerts -nokeys -in ca.p12 -out ca.pem
There's the options i'm sending in the code:
-------------------------------------------
cg.setopt(CURL.OPT_WRITEFUNCTION, cw);
cg.setopt(CURL.OPT_VERBOSE, 3);
cg.setopt(CURL.OPT_FRESH_CONNECT, 1);
cg.setopt(CURL.OPT_SSL_VERIFYPEER, 0);
cg.setopt(CURL.OPT_SSL_VERIFYHOST, 0);
cg.setopt(CURL.OPT_SSLCERTTYPE, "PEM");
cg.setopt(CURL.OPT_SSLVERSION, 3);
cg.setopt(CURL.OPT_SSLCERT, ca_cert_file);
cg.setopt(CURL.OPT_SSLKEYPASSWD, "XXXXXXXXX");
-------------------------------------------
Am i doing something wrong? Anyone can help me?
Thanks in advanced for any suggestion,
Luis Cruz
Received on 2007-05-06