DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Implement a Distributed Database to Your Java Application
  • How to Secure Apache Ignite From Scratch
  • How to Develop Microservices With Spring Cloud and Netflix Discovery
  • Jakarta Security and REST in the Cloud: Part 2 Getting to Know the Basics

Trending

  • A Guide to Auto-Tagging and Lineage Tracking With OpenMetadata
  • Analyzing Techniques to Provision Access via IDAM Models During Emergency and Disaster Response
  • Advancing Your Software Engineering Career in 2025
  • Navigating Change Management: A Guide for Engineers
  1. DZone
  2. Software Design and Architecture
  3. Security
  4. Differences between Keystore and Truststore

Differences between Keystore and Truststore

Finally master pesky Keystore and Truststore.

By 
Crumb Peter user avatar
Crumb Peter
·
Oct. 01, 19 · Presentation
Likes (6)
Comment
Save
Tweet
Share
60.7K Views

Join the DZone community and get the full member experience.

Join For Free

metal-keys-on-a-ring


Keystore and Truststore are both important and essential for communication with an SSL Certificate. Both are very similar in terms of construct and structure, as both are managed by a key tool command.

Truststore is used for the storage of certificates from the trusted Certificate Authority (CA), which is used in the verification of the certificate provided by the server in an SSL connection. On the other hand, a Keystore is used to store the private key and own identity certificate to be identified for verification.

You may also like: How to Generate a Keystore and CSR Using the Keytool Command.

In an SSL handshake, the work of Truststore is to verify the credentials, whereas the work of Keystore is to provide those credentials. These are the most important differences between Truststore and Keystore but not the only ones. These differences vary in Java and they are as follows –

  • Truststore is used by Trust Manager and Keystore is used by Key Manager; they both perform different functions.

  • Keystore contains private keys and is required only when a server is running on an SSL connection, whereas Truststore store public keys and the certificates issued form the certificate authority.

  • To specify the path of a Keystore or Truststore, we need different extensions in Java. (Djavax.net.ssl.keyStore for Keystore and -Djavax.net.ssl.trustStore for Truststore.)

  • There is also a difference in the password of the two (i.e. for Keystore it is given by the following extension Djavax.net.ssl.keyStorePassword and for truststore is given by Djavax.net.ssl.trustStorePassword).

  • Keystore contains one private key for the host, while truststore contains zero private keys.

The listing, removal, and addition of certificates can be done from the Java Keystore by using the keytool utility. Almost all of the SSL clients have access to the Truststore.

Security Considerations for Keystore and Truststore 

Keystores contain private keys, whereas Truststore do not. Security for Keystores is strict and exacting. In particular –

  • Hadoop SSL (Secure Sockets Layer) has a requirement that Truststores and the Truststore password have to be stored in plaintext, in a configuration file that can be read easily by everyone.
  • Keystore and key passwords are stored in plaintext, in a file that is readable only by members of the appropriate group.
  • Since Truststore does not contain any private and sensitive information, only a single Truststore for an entire cluster is sufficient.
  • But it is essential information that the passwords for both Truststore and Keystore should not be the same because the password for Truststore is stored in clear files and is visible to all. If the same password is used for a Keystore, the security will be vulnerable and can be attacked by malicious parties and hackers.

Creating Trusutstores 

If one is using the default Truststore, he/she needs to add Certificate Authority (CA) to the Truststore or delete them from Truststore. If you are creating a custom Truststore, you must build the Truststore by importing trusted certificates into new Truststores. While creating a Truststore, a password has to be created/selected, and they should be the same for a given service.

The purpose of a Keystore is to protect privacy and integrity with the use of a password-based algorithm. The keys are kept secret to keep them safe and protected from unwanted third parties and can only be accessed by someone having the password.


Related Articles

  • Securing REST APIs With Client Certificates.
Certificate authority security Java (programming language) Connection (dance) Command (computing) cluster Host (Unix) AI Web Protocols

Published at DZone with permission of Crumb Peter. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Implement a Distributed Database to Your Java Application
  • How to Secure Apache Ignite From Scratch
  • How to Develop Microservices With Spring Cloud and Netflix Discovery
  • Jakarta Security and REST in the Cloud: Part 2 Getting to Know the Basics

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!