Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alternatives for sun.security.*

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Sun/Oracle JDK 1.6 I have access to and are using the following imports from the JDK.
import sun.security.pkcs.PKCS10;
import sun.security.x509.X500Name;
import sun.security.x509.X500Signer;

As of Sun/Oracle JDK 1.7 these are no longer available. What can I use instead of these? Are there any alternatives in either JDK or some other API?

I am using these to generate a Certificate Signing Request (PKCS#10) in Java. I want to do this programmatic and not via a seperate running tool like OpenSSL or Java Keytool.
 
Tim Moores
Bartender
Posts: 2795
38
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like JDK7 haven't gotten rid of all the classes in sun.security. BouncyCastle is still using some of its classes.
Just the X500Signer class is gone from JDK7.

The following code is working fine to create a Certificate Signing Request:


This I have tried to replace with the following BouncyCastle code:

But it gives the following complaint: java.security.NoSuchProviderException: no such provider: BC
I can specify a provider in PKCS10CertificationRequest, but I am unsure what this is supposed to be.

Edit: I found the solution to this: When passing null for provider it creates a Signature that same way as my first solution without provider.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic