Java Keystore Viewer
Operator: Abdulla Al Fahad. How tools are built and checked
A .jks file is a binary container in which Java keeps private keys and trusted certificates, and the only protection on the file itself is a SHA-1 digest mixed with the store password. That is enough to notice a changed byte or a wrong password, and not enough to say anything about who made the file, so a viewer has to keep those two ideas apart.
This page reads JKS and JCEKS stores, checks the digest when you give it the store password, lists every alias with its certificate chain, and recovers a private key from either format when you give it the key password. PKCS12 keystores, which the JDK has written by default since Java 9, are a different format and belong in the PFX converter.
Key features
- Integrity check: the SHA-1 digest at the end of the file is recomputed from the store password and compared, and the result is reported as matches, does not match, or not checked when no password is entered
- Alias list with entry type (private key, trusted certificate or JCEKS secret key), the date the entry was saved, chain length, leaf subject and expiry with an expired badge
- Certificate chain detail for each entry: subject, issuer, validity, key description, names, and SHA-256 and SHA-1 fingerprints
- Private key recovery with the key password for JKS entries and for JCEKS private-key entries, followed by a check that the key's public half matches the leaf certificate. JCEKS secret keys (tag 3) are listed but not decrypted
- Exports as certificate PEM (whole chain), encrypted PKCS#8 PEM, PFX built with AES-256, or a plain PKCS#8 or RSA PEM that needs a tick on a warning first
How a JKS or JCEKS file is laid out and checked
Both formats start with a magic number (FE ED FE ED for JKS, CE CE CE CE for JCEKS), a version of 1 or 2, and an entry count. Each entry begins with a tag: 1 for a private key with its chain, 2 for a trusted certificate, and in JCEKS 3 for a secret key. An alias is written as Java's modified UTF-8 with a two-byte length, followed by a millisecond timestamp. Version 2 also writes the certificate type, always X.509 in practice, before each certificate.
The last 20 bytes are the digest: SHA-1 over the password with every character as two big-endian bytes, then the ASCII text Mighty Aphrodite, then every byte before the digest. Because the password is mixed in, the digest cannot be recomputed without it, and a mismatch means either a wrong password or a changed file; the two cannot be told apart from the digest alone.
In a JKS private key entry the key is an EncryptedPrivateKeyInfo whose algorithm identifier is 1.3.6.1.4.1.42.2.17.1.1. The scheme, from the JDK's KeyProtector, uses a 20-byte salt and builds a keystream by hashing the password with the salt, then the password with each previous digest, and XORs it over the PKCS#8 key. A SHA-1 of the password and the plain key is stored at the end as a check value, which is what lets a wrong key password be reported instead of producing garbage.
A JCEKS private key is written the same way, as a length and an EncryptedPrivateKeyInfo, but its algorithm identifier is 1.3.6.1.4.1.42.2.19.1, PBEWithMD5AndTripleDES. That scheme takes the 8-byte salt in two halves (reversing the first half when the halves are equal), hashes each half with MD5 over the password as many times as the stored iteration count says, and uses the 32 bytes of output as a 24-byte 3DES key and an 8-byte IV. The page reverses it and accepts the result only when it decrypts to a PKCS#8 key. Only a JCEKS secret key (tag 3) is stored as a Java-serialized SealedObject; the page walks those objects to find the entry and shows the sealing algorithm, but it does not decrypt them.
How it works
Parsing is bounded: files up to 20 MB, at most 10,000 entries, chains of at most 100 certificates, and every length field is checked against the bytes that remain before anything is read. The Java serialization walker used for JCEKS has its own limits on nesting depth and on the number of objects it will track.
A key password is tried against the check value only (for a JCEKS key, against whether the decrypted bytes parse as PKCS#8). The page never guesses passwords and has no retry loop, so entering one wrong password costs one SHA-1 pass over the key.
Passwords are handled in the page only. They are held in component state for the session, are never written to storage or the URL, and the exports use the password you type for them, not the store password.
A recovered key is analysed as PKCS#8 and compared with the leaf certificate's public key. An RSA key is compared by modulus; an EC key by public point, derived with WebCrypto when the file omits it.
When this helps
- A new team member inherits a 2014 truststore for an internal API client and needs to know which of its 38 trusted certificates expire this year; the Expires column and the expired badges in the entries table show it at a glance.
- A service is being moved from Tomcat on Java 8 to a Kubernetes ingress that wants PEM files; the leaf key and chain are recovered from the JKS and downloaded as an encrypted key PEM and a chain PEM.
- A deployment fails with a keystore tampered with, or password was incorrect error; testing the store password here shows whether the digest matches, which separates a wrong password from a damaged file.
Opening a file
- Drop the .jks, .jceks or .keystore file. The default store password in the JDK's own tools is changeit, which is worth trying first on a file of unknown origin.
- Enter the store password and choose Verify and list entries. The banner reports whether the digest matches.
- Choose Details on an alias to see its chain. For a private key entry, enter the key password (leave it blank if it equals the store password) and choose Recover private key.
- Download the certificate PEM, a PFX, or an encrypted key PEM. The plain key downloads stay disabled until you tick the confirmation.
Example
A two-entry store: key alias server and a trusted root, store password changeit, key password keypass
Alias server: private key entry with one certificate
Alias example-root: trusted certificate
Store password changeit, key password keypass (different from the store password)Integrity checks and key recovery for the two-entry store
Format JKS, version 2, 2 entries (1 key, 1 certificate); integrity digest matches
Recover private key on server with keypass: Elliptic curve P-256, public key matches the leaf certificate
Recover with the store password instead: the key password is wrong (its SHA-1 check value does not match)
Store password nope: integrity digest does not matchTips for best results
- If the digest matches but key recovery fails, the key password differs from the store password. Keystores built by older tools often use one password for the store and another per key.
- A chain whose last certificate is self-issued is complete; a chain that ends on an intermediate means the server will rely on clients having the root.
- The SHA-256 fingerprint shown for each certificate is the one most trust-store tooling prints, so it can be compared with a fingerprint quoted in an email or ticket.
Limits
A matching digest shows the file is unchanged since it was saved with that password. It does not show the contents are trustworthy, and anyone who knows the password can rebuild the file with a correct digest.
The downloads of an unencrypted private key are plain text that anyone can use. The page asks for confirmation, but it cannot stop the file being copied after it is saved.
Keystores written by Bouncy Castle (BKS and UBER) and by other tools use different layouts and key protection and are refused with a message naming the format.
Common errors and how to fix them
- This looks like a PKCS12 keystore, not JKS or JCEKS.
- Java 9 and later write PKCS12 by default even when the file is called .jks. Open it with the PFX converter, which reads PKCS12 with a password.
- The key password is wrong, or the stored key is damaged.
- The key's SHA-1 check value did not match (for a JCEKS key: decrypting it did not give a PKCS#8 key). Try the store password if you left the field blank on purpose, and check whether the entry was imported with its own password.
- This key is protected with the algorithm followed by an OID, not the Sun KeyProtector scheme (1.3.6.1.4.1.42.2.17.1.1).
- The entry was written by a provider that protects keys differently, so the page lists it but cannot recover the key. Export it with that provider's own tool.
Best practices
- Convert old JKS stores to PKCS12 with the JDK's keytool and keep the PKCS12 file, since JKS is a proprietary format with a weak key protection scheme that the JDK now treats as legacy.
- Give the PFX or encrypted PEM exports a password you will not reuse, because that password is the only thing standing between the file and the key.
Frequently asked questions
Why does the page accept an empty store password?
The JDK itself can load a keystore without a password, in which case it skips the digest check and lists the entries. The page does the same and says so in a yellow banner, so a listing is never presented as verified when it was not. A store that was saved with a blank password is a different case: tick the box that says the password is empty, and the digest is checked against it.
Can it open a keystore that Java's keytool reports as invalid?
Yes, if the entries themselves are intact. keytool refuses a store whose digest fails, while this page lists the entries and labels them unverified, because the digest covers the whole file and a single flipped byte fails it even when every entry is readable.