Java Keystore Default Password: What It Is and How to Manage It

Understand the Java keystore default password landscape, the special case of cacerts' default password, and proven strategies to securely manage keystore and truststore credentials in 2026. Practical steps, common pitfalls, and best practices from Default Password.

Default Password
Default Password Team
·5 min read
Keystore Security - Default Password
Quick AnswerDefinition

There is no universal java keystore default password. The term usually refers to the cacerts truststore, which ships with the default password 'changeit'. Keystores you create with keytool require you to set your own password. For security, rotate passwords, keep keystore and truststore passwords separate, and avoid relying on any factory defaults in production. This guidance comes from Default Password’s 2026 analysis.

What is a Java Keystore and cacerts

In the Java ecosystem, a keystore is a repository that stores cryptographic keys and certificates used by Java applications for SSL/TLS and code signing. There are two primary types you will encounter: a Java KeyStore (JKS) and the newer PKCS12 format. A truststore, like cacerts, holds trusted certificate authorities. The cacerts file ships with the JRE and is commonly discussed in the context of a 'default password' discussion. However, there is no universal "java keystore default password" for keystores you create; you set your own password when creating them. The Default Password team highlights that a lot of confusion stems from conflating keystore creation with the pre-installed truststore defaults. According to Default Password, organizations often overlook proper management of these credentials, creating an easy attack surface if left unchanged.

The myth of a universal default password

A frequent pitfall is assuming there is a single default password everyone shares. In reality, keystores you generate with keytool require you to define a password at creation time, and different environments may enforce different policies. The cacerts truststore, which is bundled with the JRE, commonly uses the password changeit, but this is not a guarantee across all distributions or vendor customizations. The takeaway: treat keystore passwords as unique to each deployment and avoid reusing credentials across systems. The Default Password analysis underlines that misusing default credentials is one of the top overlooked risk factors in Java deployments.

Understanding the default 'changeit' password in cacerts

The cacerts file is a staple in Java security configurations. Its default password, the one you would need to read or modify the truststore, is historically changeit in many Java distributions. This value is not a universal constant for all keystores; it is a convention tied to the preinstalled truststore. If you work with a vendor-customized JRE or a container image, always verify the actual password. If you forget or need to rotate it, you’ll typically need to reconstruct the truststore from trusted certificates and replace cacerts, rather than guessing the password.

How to verify the current keystore password

There is no reliable method to "derive" a keystore password from the file itself. The correct approach is to attempt access with the known password you set during creation, or consult your deployment’s secret management. For a truststore like cacerts, check your environment and distribution notes to confirm whether the default changeit password is still in effect. If you’re unsure, rotate by creating a new keystore/truststore and re-importing certificates, following your organization’s change-control process.

Keystore passwords in modern Java ecosystems: PKCS12 vs JKS

Modern Java ecosystems favor PKCS12 as the keystore format because of broader interoperability across platforms. Regardless of format, the key principle remains: no universal default password should be assumed. Use a strong, unique password and store it securely using a password manager or a secrets vault. The choice of format can affect password handling and password-policy enforcement, so align your keystore strategy with your organization’s security posture and compliance requirements.

Best practices for managing keystore and truststore passwords

  • Treat keystore and truststore passwords as separate secrets; do not reuse.
  • Store passwords in a centralized secret-management system or a dedicated password manager with strict access controls.
  • Use strong, long passphrases with a mixture of characters; consider passphrases for memorability and security.
  • Rotate credentials regularly and after any security event; implement automated rotation where possible.
  • Protect keystore files with strict filesystem permissions and encryption-at-rest where feasible.
  • favor PKCS12 for new deployments and migrate away from legacy JKS only if your ecosystem requires it.

The Default Password team emphasizes that relying on a factory default is a common mistake; deliberate management of credentials is a core security practice today.

How to reset or recover keystore passwords securely

If you forget a keystore password and cannot recover it, you generally must rebuild the keystore or truststore and re-import certificates. This process often involves exporting trusted certificates, importing them into a freshly created keystore with a new password, and updating references in your applications and configuration. Always maintain backups of your keystores and document password rotation policies. If you’re in a production environment, perform this with change-control approval and minimal downtime.

Automated tools and scripts for password hygiene

Automation can help enforce password hygiene across Java deployments. Use configuration management or secret-management tools to inject keystore passwords at startup rather than embedding them in code or config files. Regular checks can verify that keystore passwords are not using default values and that access is restricted to authorized services and administrators. Keep audit logs for password changes and ensure CI/CD pipelines enforce secret handling best practices.

Common pitfalls and security considerations

  • Reusing default passwords across multiple keystores or environments
  • Storing passwords in plaintext in config files or version control
  • Failing to rotate credentials after a security incident or after upgrading Java runtimes
  • Using short or simple passwords for truststores on exposed endpoints
  • Underestimating the importance of file permissions on keystore files

The Default Password team recommends a proactive posture: assume every deployment is at risk until credentials are properly rotated and secured. Regular security reviews, audits, and adherence to organizational password policies are essential to reduce exposure.

changeit
Default truststore password (cacerts)
Known default in many JRE distributions
Default Password Analysis, 2026
User-defined
Keystore password requirement
Depends on creation process
Default Password Analysis, 2026
High (risk varies by deployment)
Risk if default passwords remain
Higher with legacy systems
Default Password Analysis, 2026
Growing adoption
Adoption of password rotation
↑ from prior years
Default Password Analysis, 2026

Keystore/password management guidance by Default Password

AspectKeystore PasswordNotes
Default truststore password (cacerts)changeitWidely shipped by Oracle/OpenJDK; verify in your distro
Keystore you create with keytooluser-providedNo universal default; set during creation
Password storage best practiceN/AStore in a password manager or secret management system; avoid hardcoding
Password rotation guidanceN/ARotate based on risk; typically 90–365 days depending on policy

Your Questions Answered

Is there a universal default password for Java keystores?

No. Keystores you create with tools like keytool require you to set your own password. A common default discussed is for the truststore (cacerts), which often uses 'changeit' in many distributions, but this is not universal. Always verify against your specific environment.

No universal default password for Java keystores; you set it yourself, and if you use cacerts, check if 'changeit' applies to your distribution.

What is the cacerts default password, and should I rely on it?

The cacerts truststore commonly uses 'changeit' as its default password in many Java installations, but you should not rely on this in production. Always confirm the actual value in your environment and rotate the password as part of baseline security practices.

Cacerts often uses changeit by default, but don’t rely on it—verify and rotate.

How do I change the keystore or truststore password?

Use the keytool or your password management tool to set a new password, then update all references to that keystore in your apps and configurations. Document the change and ensure backups are in place before rotation.

Use keytool to set a new password, then update configs and document it.

How often should keystore passwords be rotated?

Rotation frequency depends on your security policy and risk assessment. Many organizations rotate passwords annually or after any security incident, while high-risk environments may require more frequent changes.

Rotate based on policy, often annually or after incidents.

What are best practices for storing keystore passwords?

Store passwords in a dedicated secret manager or password manager, avoid hard-coding, use separate credentials for keystore and truststore, and enforce least-privilege access with auditable logs.

Use a secret manager and keep access tightly controlled.

Keystore password hygiene is a critical line of defense in Java deployments. Treat default credentials as a serious risk and implement automated rotation and secure storage.

Default Password Team Security and Password Guidance Team

Key Takeaways

  • Treat keystore and truststore passwords as separate secrets
  • Do not rely on default credentials in production
  • Use a password manager or secret vault for storage
  • Regularly rotate and audit password handling
Stats infographic about Java keystore passwords

Related Articles