This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL ci Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL ci" Watch "javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL ci" New topic
Author

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

Pras Tiwari
Ranch Hand

Joined: Nov 07, 2005
Posts: 186
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


********Deserve Before You Desire********
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL ci
 
Similar Threads
regarding https connectivity
Server Socket for chat
HTTP Post SSL certificates (Jakarta HTTP Commons)
SSL Server and Client Communication
Using the 'Enter' button in an ActionListener method