Results 1 to 1 of 1
- 04-27-2012, 09:45 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 1
- Rep Power
- 0
SSL Client authentication question
Hello,
I am a total SSL newbie. I have to connect to a 3rd party app via a SSL/TCP connection (not https). They vendor provided example code that works under C#. I need to emulate the same connection method, but in Java. The C# code looks something like this:
client = new TcpClient(hostName, int.Parse(clientPort));
sslStream = new SslStream(client.GetStream(), ...);
sslStream.AuthenticateAsClient(serverName);
So, I am provided with only three input parameters - host name, port, and a "server name". It appears that the .net runtime function, AuthenticateAsClient, lets you authenticate the connection with just the service name (not sure if that is the correct designation). There is no certificate of any kind on the client machine that is connection to the SSL server. Although I have found many SSL/Java examples on the web, I don't know what the construct/function calls would be in a Java environment to emulate the behavior of this AuthenticateAsClient function. Any help ig greately appreciated.
Here's some more detail. I looked at the JSSE tutorial.
OK, I looked at the tutorials, and am still missing some key bit of knowledge. Here is my example code:
SSLSocketFactory sslsocketfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket)sslsocketfactory.createSocket("usatl-w-100624", 11000);
InputStream inputstream = System.in;
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader in = new BufferedReader(inputstreamreader);
OutputStream outputstream = sslsocket.getOutputStream();
OutputStreamWriter ow = new OutputStreamWriter(outputstream);
sslsocket.startHandshake();
On the call to startHandshake(), I get this error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
Of couse, this is expected, as I do not have a certificate in the java keystore. If I look at the JSSE examples, here: JSSE Samples
The SSLSocketClientWithClientAuth.java example looked relevant. However, it also is requesting a file path. My C# example does not access any file on the client. So, how do you do the equivalent in Java?
Thanks,Leor
Similar Threads
-
Multi-client authentication server
By uchihassj4 in forum New To JavaReplies: 0Last Post: 10-06-2011, 08:49 AM -
client can choose to send message to another client,
By banzuke in forum Threads and SynchronizationReplies: 3Last Post: 08-25-2011, 02:37 PM -
Multi Client/Server Chat Question
By Kodak07 in forum NetworkingReplies: 3Last Post: 03-29-2009, 10:50 PM -
Datagram Client and Server, client timer question
By saru88 in forum NetworkingReplies: 1Last Post: 10-05-2008, 03:12 PM -
Identify Client in Socket Client Server Application
By masadjie in forum NetworkingReplies: 1Last Post: 12-20-2007, 09:18 AM


LinkBack URL
About LinkBacks

Bookmarks