cURL / Mailing Lists / curl-users / Single Mail

curl-users

JavaCurl problem calling url

From: <lmpcruz_at_sapo.pt>
Date: Sat, 05 May 2007 14:40:01 +0100

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=7959A85BD7A7B8F94FD0DC2D6BD92829B1B186B1&A061=10.50&A105=9782&A037=20070430105929

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&C003=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-05