File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes SSLHandshakeException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "SSLHandshakeException" Watch "SSLHandshakeException" New topic


Adam Teg
Ranch Hand

Joined: Jul 10, 2007
Posts: 58
I have a certificate but I keep on getting the exception below. unknown certificate
at Source)
at Source)
at com.guidant.apm.lpi.parser.HttpsSample2.main(

My sample code is below.

How do I (client) authenticate my self to the server with the certificate. Any help will be appreciated.

InputStream inStream = new FileInputStream("C:\\LPIworkspace\\LPI\\cert\\Paceart.cer");

CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
pub = (RSAPublicKey) cert.getPublicKey();
int port = 443;
String hostname = "emr-paceart";
SocketFactory socketFactory = SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)socketFactory.createSocket(hostname, port);
I agree. Here's the link:
subject: SSLHandshakeException