Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


Adam Teg
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!