You can get API information here.
From here you can find information around keyTool, which is used to create certificates.
The following commands can help you.
keytool -genkey -keystore server-keystore.jks -alias server_alias \ -dname "CN=hostnameofserver,OU=orgunit" \ -keyalg "RSA" -sigalg "SHA1withRSA" -keysize 2048 -validity 365 keytool -export -keystore server-keystore.jks -alias server_alias -file server.crt keytool -import -keystore client-truststore.jks -file server.crt
From JDK 1.6, you can also programmatically access MS CryptoAPI.
source share