从sun.security。*包中替换类 [英] replace classes from sun.security.* packages

查看:287
本文介绍了从sun.security。*包中替换类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将应用程序从JDK7升级到JDK8,后者使用 sun.security。* 包中的以下类

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

除了 sun.security.pkcs.PKCS10 之外,这些类的使用会在所有情况下生成警告,这会导致编译错误,因为此类不再存在。它似乎已移至另一个包 sun.security.pkcs10.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.

虽然我可以简单更改此包名称并忽略其他 sun.security 类生成的警告,我理解你不应该在 sun.security 中使用类。如何使用等效的JDK8公共API替换这些类?

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?

推荐答案

没有任何等价物JDK8公共API。您应该切换到 BouncyCastle API

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

这篇关于从sun.security。*包中替换类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆