img credit
A Keystore and a Truststore are two types of stores used in Java to manage digital certificates and keys.
A Keystore: The keystore is used to store private keys and their associated certificates, which are used to identify the client or server during the SSL/TLS handshake.
A Truststore: The truststore is used to store trusted certificates, typically those of Certificate Authorities (CAs) that are trusted to verify the certificates presented by the other party during the SSL/TLS handshake.
A Certificate is a digital document that binds a public key to an identity. It is issued by a trusted certificate authority and contains information about the identity of the entity that holds the corresponding private key, such as its name and location. Certificates are used to establish trust and secure connections between entities, such as between a client and a server during an SSL/TLS connection.