Java Keytool, Keys and Certificates

app-1 will provide a copy of his public key to app-2 and signs the communication with its private key.

Step 1: app-1 creates private/public key pair in its keystore:
$ keytool -genkey -alias "app-1-key" -keystore app-1.jks
Verify:
$ keytool -v -list -keystore app-1.jks

Step 2: app-1 generates a certificate file from its private keystore:
$ keytool -export -alias "app-1-key" -file app-1.cer -keystore app-1.jks

Step 3: app-2 imports the public key of app-1 into its keystore:
$ keytool -import -alias "app-1-publickey" -file app-1.cer -keystore app-2-publickey.store