简体   繁体   中英

Creating Self Signed Certificate and KeyStore from GUI

We have an application locally hosted on which we create self signed certificate and keystore using java keytool command line utility in order to run the application over https.

We are now changing and wants to create keystore and self-signed certificate from a Graphical User interface. So is there any opensource tool available which can cater all the requirement or I have to develop this using Java Swings?

Please suggest what is the best option.

As far as I know, there's nothing in the public API of the JRE to let you do this, but you can issue certificates using third-party libraries such as BouncyCastle. There is a snippet of code in this question to give you an example (although don't forget to read the question and its answer if you want to avoid that particular problem). Of course, you can also look at the documentation for X509v3CertificateBuilder directly too.

It's not very difficult to use, but you may need to try multiple solutions first, to get to the point where you generate a certificate with the attributes and extensions you need.

It's worth keeping using keytool during development, to export and compare certificates. Using openssl x509 -text ... to check the content of the certificates you're generating is also useful.

Use ProcessBuilder , illustrated here , to execute the required keytool command. Use JPasswordField to let the user enter the required keystone password. Consider using the approach shown here with and a self-signed certificate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM