Alternative to CertandKeygen for self signed certificate generation in java

南楼画角 提交于 2019-12-24 00:58:52

问题


I have the following way of generating a self signed certificate using the class CertandKeyGen.

CertandKeyGen cert = new CertandKeyGen("RSA", "SHA256withRSA);  
cert.generate(size);  
..  
X509Certificate certificate = cert.getSelfCertificate(name, validity);

Since these are internal APIs from keytool, I am looking at a similar approach using java.security.* APIs. I want to know if this is possible currently. If yes, what are those APIs? I dug around but I am unable to find anything about it. I am aware of bouncy castle APIs (X509V3CertificateGenerator) but I do not want to use third party APIs.

Thanks.


回答1:


At present, I do not believe that the generation/signing mechanisms that are used in keytool are part of the public API for Java.

I have implemented a very simple CA/Signing mechanism utilizing BouncyCastle for testing purposes.

I don't think you're going to be able to do this without a 3rd party api or implementing a very significant amount of code on your own.



来源:https://stackoverflow.com/questions/36220377/alternative-to-certandkeygen-for-self-signed-certificate-generation-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!