replace classes from sun.security.* packages

java, java-7, java-8, security

Solution

There aren't any equivalents in the JDK8 public API. You should switch to the BouncyCastle API instead.

Problem

I'm trying to upgrade an app from JDK7 to JDK8 which uses the following classes from the `sun.security.*` packages ``` sun.security.x509.X509CertImpl sun.security.pkcs11.SunPKCS11 sun.security.util.DerOutputStream sun.security.util.DerValue sun.security.util.ObjectIdentifier sun.security.pkcs.PKCS10 sun.security.x509.X500Name sun.security.pkcs11.SunPKCS11 sun.security.pkcs11.wrapper.CK_TOKEN_INFO sun.security.pkcs.PKCS10 ``` The usage of these classes generates warnings in all cases except for `sun.security.pkcs.PKCS10` which causes a compilation error, because this class no longer exists. It seems that it has moved to a different package `sun.security.pkcs10.PKCS10`. While I could simply changes this package name and ignore the warnings generated by the other `sun.security` classes, I understand that you're not supposed to use classes in `sun.security` packages. How do I go about replacing these classes with their equivalent from the JDK8 public API?

Original source