Keytool is a Java-brought tool for generating keys
KeyStore can be seen as a library of key, key is a public key, private key, digital signature and other components of a message.
Truststore is a store that puts a trusted certificate.
What do they have to do with the relationship? What role do they play in a secure link model?
Well, I'm not really sure,-_-b.
I'll write down the current understanding, and then revise it slowly.
This article is mainly for Web applications, Web applications are generally through the HTTPS,SSL to do the client and server side of the link
As an example of one-way verification, the server-side app server is tomcat
The most common (and I feel Simple) security scheme is one-way verification, which means that client IE verifies the identity of the server. This requires some configuration on the server side.
1. In the command line, generate a key in KeyStore by using Keytool.
There are two concepts here, KeyStore and key.
Key, which holds the digital certificate (including the public key and the publisher's digital signature), and the private key
KeyStore, can be considered as a repository of key, in the form of files in the system, the default is placed under C:\Documents and settings\user...\, you can also specify the path and file name on the command line
2. Export key as a digital certificate from KeyStore, digital certificate (including public key and publisher's digital signature)
3. Import the digital certificate into Truststore, typically the Jre\lib\security\cacerts file under Java_home used by Tomcat
In fact, the nature of Truststore and KeyStore is the same, is a repository of key storage, the difference is that the truststore is stored only a public key digital certificate, representing the certificate can be trusted, and KeyStore is the private key. But the specific application still needs to be researched deeply, here I am not very clear
4. Configure the appropriate SSL port in the Server.xml under Tomcat so that the client can access the server via HTTPS
The difference between turning/keystore and Truststore