473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

passing cert location + password to a custom JSSESocketFactory

I have a custom JSSESocketFactory class that can take a PKCS12
certificate and password and use it to talk through axis to a secure web
service. That works....

The problem is it needs to work on a shared hosting environment where
each customer will have thier own certificates, the certificate is used
used to verify their identity. I've been staring at the JSSE but am at
somewhat of a loss as how to pass the cert location/password TO the
class. :)

If anyone can shed a bit of light on this dilemia that would be helpful.

(There's apparently an attributes hashtable with the default
secureSocketFactory that for a moment I was hoping might be used for
this but... to be honest after staring at it a while I'm still somewhat
in the dark what it's purpose is.)

Thanks,
-lewis
Jul 17 '05 #1
1 2805
Lewis Sellers wrote:
I have a custom JSSESocketFactory class that can take a PKCS12
certificate and password and use it to talk through axis to a secure
web service. That works....

The problem is it needs to work on a shared hosting environment where
each customer will have thier own certificates, the certificate is
used used to verify their identity. I've been staring at the JSSE but
am at somewhat of a loss as how to pass the cert location/password TO
the class. :)

If anyone can shed a bit of light on this dilemia that would be
helpful.


You could use the -D option to pass the file location, per example:

java -Djavax.net.ssl.keyStore=/path/to/pkcs12file

But the most convenient way, IMO, would be to use a properties file, which
you can read with the java.util.Properties class:

import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.IOException;

import java.util.Properties;
....
FileInputStream in = new FileInputStream("/path/to/properties_file");
Properties properties = new Properties();
Properties properties.load(in);

The properties file can then be read to get the path to the pkcs12 file and
its password:

System.setProperty("javax.net.ssl.keyStore",
properties.getProperty("pkcs12file"));
System.setProperty("javax.net.ssl.keyStorePassword ",
properties.getProperty("pkcs12fpassword"));
System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");

The properties file itself would look like this:

pkcs12file=/path/to/pkcs12file
pkcs12password=password
HTH;
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
1
by: Hans [DiaGraphIT] | last post by:
Hi! I have problem with passing data to custom action. I don't know what wrong I'm doing. I'm trying to follow the steps in the walkthrough: "Passing Data to a Custom Action" ...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
7
by: Wade Wegner | last post by:
Hello, I have been desperately trying to programmatically authenticate a windows user, create their credentials, and then redirect them to a different server while passing the credentials at the...
0
by: Eric Sabine | last post by:
OK, I'm trying to further my understanding of threading. The code below I wrote as kind of a primer to myself and maybe a template that I could use in the future. What I tried to do was pass data...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
22
by: K. A. | last post by:
I have two servers at work, 'A' for testing and development, and server 'B' for production. On server A, I wrote a PHP test code to login users then direct them to a personalized page. This is...
0
by: hepsubah | last post by:
I'm trying to capture a client cert in my ASP.NET application, and use that cert as the client cert for a call to secure web service. I've used the following code, but am getting a 403 error on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.