I seguenti comandi permettono di creare e gestire un keystore tramite keytool:
Generazione keystore:
keytool -genkey -keyalg [Algoritmo: RSA o DSA] -alias [NOME_ALIAS] -keystore [NOME_FILE_KEYSTORE].jks
lettura keystore (richiede la conoscienza della password settata durante la generazione):
keytool -list -keystore [NOME_FILE_KEYSTORE].jks
Esportazione di un certificato selfsigned dal keystore:
keytool -export -alias [NOME_ALIAS] -keystore [NOME_FILE_KEYSTORE].jks -file [NOME_CERTIFICATO].cer
Importazione di un certificato nel truststore:
keytool -import -alias [NOME_ALIAS] -trustcacerts -keystore [NOME_FILE_KEYSTORE].jks -file [NOME_CERTIFICATO].cer