• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to add a Digital Certificate

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a digital certificate (X.509) with the .pfx extension and the code that was written to add as follows:

private void setupForSSL() {

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties properties = System.getProperties();
String handlers = System.getProperty("java.protocol.handler.pkgs");

if (handlers == null) {
// nothing specified yet (expected case)
properties.put(
"java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
}
else {
// something already there, put ourselves out front
properties.put(
"java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol|".concat(handlers));
}

System.setProperties(properties);

// put the updated properties back in System
}

I used Keytool to add the certificate and when i ran this C:\Java\TestingClient>keytool -import -file hooper509.pfx -keystore hooper
Enter keystore password: xxxxxxxxxxxxx

I got this error
keytool error: java.lang.Exception: Input not an X.509 certificate

Any help would be appreciated.

Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic