Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL ci

 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am writing small chat program in java. The server code for same is as follows:-
==================
package pp.pal;

import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.SocketAddress;

/*
*keytool -genkey -keystore mySrvKeystore -keyalg RSA
*java -Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=123456 EchoServer
*java -Djavax.net.ssl.trustStore=mySrvKeystore -Djavax.net.ssl.trustStorePassword=123456 EchoClient
*/
public class EchoServer extends Frame implements ActionListener
{
static TextArea ta;
Button sub;
static TextField tf;
Panel p;
static OutputStream outputstream;
static OutputStreamWriter outputstreamwriter;
static String string;
static SSLServerSocketFactory sslserversocketfactory;
static SSLServerSocket sslserversocket;
static SSLSocket sslsocket;
EchoServer()
{
super("Server");
setLayout(null);
Panel p=new Panel (new GridLayout(1,1));
Rectangle r=new Rectangle(100,100,400,300);
r.setLocation(50,100);
p.setBounds(r);

Font f=new Font("Arial",Font.BOLD,20);
ta=new TextArea(50,20);
ta.setFont(f);
ta.setEditable(false);

sub=new Button("Submit");
tf=new TextField(30);
p.add(ta);
add(p);

Label l=new Label("Type ur Text here:");
Panel p1=new Panel();
Rectangle r1=new Rectangle(100,100,450,250);
r1.setLocation(450,550);
p1.setBounds(r1);
p1.add(l);
p1.add(tf);
p1.add(sub);
add(p1);
setSize(300,200);
setVisible(true);
sub.addActionListener(this);
addWindowListener(new myAdapter());
}
class myAdapter extends WindowAdapter
{
public void windowClosing(WindowEvent w)
{
setVisible(false);
System.exit(0);
}
}
public void actionPerformed(ActionEvent ae)
{
try
{
OutputStream outputStream = sslsocket.getOutputStream();
outputstreamwriter = new OutputStreamWriter(outputstream);
PrintWriter pw= new PrintWriter(outputstreamwriter,true);
ta.append("Server says:"+tf.getText()+"\n");
pw.println("Server says:"+tf.getText());
tf.setText("");
}
catch(Exception e){}
}

public static void main (String[] arstring)
{
try
{
new EchoServer();
sslserversocketfactory=(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
sslserversocket=(SSLServerSocket)sslserversocketfactory.createServerSocket(12123);
sslsocket=(SSLSocket)sslserversocket.accept();
InputStream inputstream= sslsocket.getInputStream();
InputStreamReader inputstreamreader=new InputStreamReader(inputstream);
BufferedReader br =new BufferedReader(inputstreamreader);
string=null;
while((string=br.readLine())!=null)
{
System.out.flush();
ta.append(string+"\n");
}
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}
=========================

But when I m running the program I m getting error like:-=
============================================
javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL cipher suites which are enabled.
at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:303)
at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:253)
at pp.pal.EchoServer.main(EchoServer.java:94)
===========================================

I can't undersatnd what is problem?
Please help me.
Thanx in advance.
Prash
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post the same question in multiple forums. We all read more than one forum so you are not increasing your audience. Crossposting can cause confusion and duplication of effort as the community tries to answer every question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic