• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Algorithm X509 not available

Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use a pfx file for client certification
The code is as below -
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
FileInputStream fis = new FileInputStream("D:\\CertificationServer\\merchantopus.pfx");
KeyStore ks2 = KeyStore.getInstance("PKCS12", "BC");
KeyManagerFactory kmf = kmf = KeyManagerFactory.getInstance("X509");
The following lines give the error -
java.security.NoSuchAlgorithmException: Algorithm X509 not available
at com.sun.net.ssl.b.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.KeyManagerFactory.getInstance([DashoPro-V1.2-120198])
at BCTest.test(BCTest.java:28)
at BCTest.main(BCTest.java:12)
Could someone provide pointers to resolve the error?
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error is actually quite meaningful - X509 isn't available as an algorithm. What this means is that none of the installed providers has an implementation of "X509" that can be used by KeyManagerFactory.
For instance, listing the available algorithms could be done like this :-

You will probably find that X509 is not listed.
I'm haven't used the bouncy castle provider, however, there should be a algorightm that is supplied with the JDK (at least it was with jdk1.3) called SunX509 which can be used when invoking KeyManagerFactory.getInstance()
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic