• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Algorithm X509 not available

 
Ashutosh Shinde
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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?
Thanks,
Ashutosh
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • 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()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic