sun.security.x509.CertAndKeyGen and sun.security.p

2020-07-09 08:28发布

In JDK8 the class sun.security.x509.CertAndKeyGen does not exists anymore. Also sun.security.pkcs.PKCS10 is missing. In JDK7 they existed. What could be an alternatives to these classes methods?

3条回答
来,给爷笑一个
2楼-- · 2020-07-09 09:14

You should switch to the BouncyCastle API instead.

查看更多
再贱就再见
3楼-- · 2020-07-09 09:21

I think you are looking for: sun.security.tools.keytool.CertAndKeyGen

You'll find it inside the rt.jar under the JRE libraries.

Keep in mind this class is outside of J2SE, it's likely only available with OpenJDK, so for example the GNU Compiler won't have it.

查看更多
Ridiculous、
4楼-- · 2020-07-09 09:22

If you are using maven, put this in pom.xml. (from this question):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.2</version>
  <configuration>
     <fork>true</fork>
     <compilerArgument>-XDignore.symbol.file</compilerArgument>
  </configuration>
</plugin>
查看更多
登录 后发表回答