If you want to sign the certificate yourself (only if you will use it for intra-server communication without exchanging personal / confidential information):
1) Create a CSR using -certreq
keytool -certreq -alias keyAlias -keystore locationPk -storepass yourpass -file myowncertrequest.csr
2) Create a certificate using csr above:
keytool -gencert -infile myowncertrequest.csr -alias keyAlias -keystore locationPk -storepass yourpass -outfile myownsignedcert.cer
3) Import this into the Separate Trust repository
keytool -import -trustcacerts -alias myown -file myownsignedcert.cer -keystore intra_server_truststore -storepass goodpassword
This will create a custom trust store that will only be used in your own domains and for some basic authentication and data exchange. But you should use an appropriate CA to sign these certificates if they expose services to the outside world.
source share