dcsimg
2 WAY SSL CLIENT TO Apache server
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   harinath_mallepally
Posted On:   Thursday, May 27, 2004 09:42 AM

Hi all. I am struggling to develop a client application using SSL to connect to apache and download a file. my steps are created client.key, client.crt, server.key,server.crt using my self singed CA (ca.key,ca.crt) my apache is using server.key, server.crt how do i send data to server encrypted with client certificate from client java program to the server (apache) i am not able to figure out what to do.. please assist me my program is as followd.. i created a virtual host at port 9999 when i did SSLClientverify to "require" i am getting trouble.    More>>

Hi all.

I am struggling to develop a client application using SSL to connect to apache and download a file.


my steps are


created client.key, client.crt, server.key,server.crt using my self singed CA (ca.key,ca.crt)


my apache is using server.key, server.crt




how do i send data to server encrypted with client certificate from client java program to the server (apache)


i am not able to figure out what to do..


please assist me



my program is as followd..


i created a virtual host at port 9999


when i did SSLClientverify to "require" i am getting trouble.



I am pretty clear about the problem. how to set the client java program to use a certificate i am not sure abt it.

Help please


//Apache SSL configuration





ServerName 11.1.14.18

SSLEngine on

ErrorLog logs/ssl_error_log

TransferLog logs/ssl_access_log

SSLCipherSuite
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/httpd/conf/ssl.crt/server2.crt

SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server2.key

SSLCertificateChainFile /etc/httpd/conf/ssl.crt/ca.crt

SSLCACertificateFile /etc/httpd/conf/ssl.crt/ca.crt

SSLVerifyClient none


#here some other few lines..






///


//End of apache ssl configuration



import java.io.IOException;

import java.io.PrintStream;

import java.io.InputStreamReader;

import java.io.BufferedReader;

import java.net.InetAddress;


import java.net.UnknownHostException;

import java.io.*;

import java.net.*;

import java.util.*;


public class TestClient {


public TestClient(){

try{

System.out.println("Sending XML with http ");

java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");


System.setProperty("javax.net.debug", "all");

System.setProperty("javax.net.ssl.keyStore", "/tmp/2505certs/clientkeystore");

System.setProperty("javax.net.ssl.keyStorePassword", "password");
System.setProperty("javax.net.ssl.trustStore", "/tmp/2505certs/truststore");

System.setProperty("javax.net.ssl.trustStorePassword","password");



URL url = new URL("https://harinathmallepally.com:9999/WebServices/WS?WSDL");

System.out.println("after url created");

//URLConnection uc = (URLConnection)url.openConnection();

//System.out.println("after connection establisht");

//uc.setDoOutput(true);

//uc.setDoInput(true);

//uc.setAllowUserInteraction(false);

//BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

//System.out.println("The instance of url.openConnection |" +url.openConnection() +"|");

com.sun.net.ssl.HttpsURLConnection connection = (com.sun.net.ssl.HttpsURLConnection)url.openConnection();


BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));


PrintWriter pw = new PrintWriter(new FileWriter("output.xml"));


String inputLine;


while ((inputLine = in.readLine()) != null)

pw.println(inputLine);


in.close();

pw.close();


}catch(Exception e){

e.printStackTrace();

}

}


public static void main(String arg[]){


System.out.println("before");

TestClient obj= new TestClient();

System.out.println("after");


}

}

   <<Less
About | Sitemap | Contact