dcsimg
Is 512 bit Test CA Root Certificate compatible with 1024 Trial Server ID from Verisign ?(find code attached with the query)
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Velidanda_Srinivas
Posted On:   Friday, December 21, 2001 04:02 AM

Hi, I have been working with the SSL and the following code is working fine with self signed certificates, but giving error with Verisign Trial Server ID(1024 bit certificate). 1.I have used the Keytool to get the self signed certificate and imported the certificate to cacerts. 2.I got the Trial server id from Verisign using the CSR created by Keytool. I have exported the certificate from verisign to .cer file(DER format) using IE5. Trial server id is of 1024 bit where as the CA cert from Verisign is of 512 bits, Does it create any problem? if yes, can i get 1024 bit CA cert from Verisign. Errors are coming even after importing the Trial server and CA    More>>

Hi,

I have been working with the SSL and the following code is working fine with
self signed certificates, but giving error with Verisign Trial Server ID(1024 bit certificate).



1.I have used the Keytool to get the self signed
certificate and imported the certificate to
cacerts.



2.I got the Trial server id from Verisign using the CSR created by Keytool.



I have exported the certificate from verisign to .cer file(DER format) using IE5.



Trial server id is of 1024 bit where as the CA cert from Verisign is of 512 bits,


Does it create any problem? if yes, can i get 1024 bit CA cert from Verisign.



Errors are coming even after importing the Trial server and CA cert into


jrelibsecuritycacerts file




SecureServer.java




import javax.net.ssl.*;

import java.net.*;

import java.io.*;


public class SecureServer

{

private static final int port = 4321;


public static void main(String []args) throws Exception

{


SSLServerSocketFactory ssf = (SSLServerSocketFactory)
SSLServerSocketFactory.getDefault();


SSLServerSocket ss=SSLServerSocket)
ssf.createServerSocket(port);


System.out.println("Ready to accept messages!");

Socket s = ss.accept();


System.out.println("A client has connected!");

DataInputStream dis = new DataInputStream(s.getInputStream());

DataOutputStream dos = new DataOutputStream(s.getOutputStream());

String line = null;

try {

while (true) {

line = dis.readUTF();

System.out.println("Client sent: " + line);

dos.writeUTF("You send: " + line);

}

}

finally {

dis.close();

dos.close();

s.close();

}

}

}


SecureClient.java


import javax.net.ssl.*;

import java.net.*;

import java.io.*;


public class SecureClient

{

private static final String host = "192.168.1.6";

private static int port = 4321;


public static void main(String []args) throws Exception
{


SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();

SSLSocket s = (SSLSocket)sf.createSocket(host, port);

s.startHandshake();

DataInputStream dis = new DataInputStream(s.getInputStream());

DataOutputStream dos = new DataOutputStream(s.getOutputStream());


System.out.println("Connected.
");

System.out.println("Type messages to send to server, exit to end!");


BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String line;

while ((line = br.readLine()) != null)
{
if (line.equals("exit")) break;


dos.writeUTF(line);

dos.flush();


String reply = dis.readUTF();

System.out.println("Server reply: " + reply);

}


dis.close();

dos.close();

s.close();

}

}



Error at Server side


C:sslsimpleserver>java -Djavax.net.ssl.keyStore=S5Employer.keystore -Djavax.ne
t.ssl.keyStorePassword=s5employer SecureServer

Ready to accept messages!

A client has connected!

Exception in thread "main" java.io.EOFException
at
java.io.DataInputStream.readUnsignedShort(DataInputStream.java:293)
at
java.io.DataInputStream.readUTF(DataInputStream.java:519)
at
java.io.DataInputStream.readUTF(DataInputStream.java:496)
at SecureServer.main(SecureServer.java:24)





Error at Client side


C:sslsimpleclient>java -Djavax.net.ssl.trustStore=s5X509trust SecureClient

Exception in thread "main" javax.net.ssl.SSLException: untrusted server cert cha
in

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])

at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198
])

at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPr
o-V1.2-120198])

at com.sun.net.ssl.internal.ssl.Handshaker.process_record([DashoPro-V1.2
-120198])

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])

at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120
198])

at java.io.OutputStream.write(OutputStream.java:61)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake([DashoPro-V
1.2-120198])

at SecureClient.main(SecureClient.java:17)



Pl send me the fix ASAP.


Thank you,


Srinivas.
   <<Less
About | Sitemap | Contact