Discovery

Finding Hidden Certificates in Java Keystores (JKS and PKCS#12)

Every enterprise estate has Java services, and every Java service has keystores. JKS and PKCS#12 files are the single largest blind spot in most TLS certificate inventories — the certs don't appear in cert-manager, don't show in Kubernetes secrets, and don't surface in CT logs. With 100-day certificate lifetimes arriving 15 March 2027, finding them stops being optional.

S
Seyedu Raja
Security Engineering Manager
2026-11-12
13 min read

The Blind Spot

Your certificate inventory tool shows 4,200 TLS certs. Your network scanner finds 4,100 TLS endpoints. Your CT-log monitor turns up 4,300 issued certificates for your domains. The three numbers are close, so operators call it reconciled and move on.

What the numbers miss is the certificates inside Java keystores — .jks, .p12, .pfx, .keystore, .truststore files sitting on disk on application servers, inside WAR files bundled with applications, in Docker image layers, in Kubernetes secrets created with kubernetes.io/tls but containing a PKCS#12 blob instead of raw PEM.

Those certificates:

  • Don't serve on a listening TLS port the way an nginx cert does — they're loaded into the JVM for outbound mTLS, JMS SASL/PLAIN with SSL, LDAPS lookups, SOAP client signing, Oracle Wallet client authentication. A port scan doesn't find them.
  • Don't appear in Certificate Transparency logs if they're internally-issued private-trust certs (which most of them are).
  • Don't surface in cert-manager because they predate Kubernetes.
  • Don't show up in cloud API inventories because the JKS sits on an EC2 instance's disk, not in ACM.

And they expire. At 398-day cadence, Java keystore expiry was a once-or-twice-a-year fire drill. At 100-day cadence (post-15-March-2027), every forgotten JKS produces 3-4 outages per year. This is the discovery problem the industry is quietly mishandling.

What's Inside a Java Keystore

A keystore file is a container format. Two main variants:

JKS — Java Key Store

The historical default, native to Sun's / Oracle's JDK since Java 1.2. Proprietary binary format. Password-protected. Stores one or more entries, each of which is either a PrivateKeyEntry (a private key plus its certificate chain) or a TrustedCertificateEntry (just a certificate used as a trust anchor).

Since Java 9, JKS is deprecated in favour of PKCS#12 (JEP 229). New JDKs still read JKS but write PKCS#12 by default. In the field, JKS files from pre-Java-9 deployments remain extremely common.

PKCS#12 — The standard

RFC 7292. Standardised, cross-platform (Java, OpenSSL, Windows, macOS all read/write it). File extensions .p12 or .pfx. Same conceptual model as JKS — entries holding keys + chains or standalone certificates — but with standardised ASN.1 structure.

Java accepts PKCS#12 anywhere JKS is accepted. Since Java 9 it's the preferred format.

JCEKS, BKS, and other variants

.jceks (Java Cryptography Extension Key Store) — stronger encryption than JKS, supports secret keys in addition to key pairs. BKS (Bouncy Castle Key Store) — BC-specific format used on Android historically. Less common but present in older or mobile-adjacent deployments.

The Discovery Problem

Finding keystores is a filesystem walk problem, not a protocol problem. You can't ask a server over the wire "what keystores do you have?" — you have to look.

Where keystores hide

Experience from production estates:

  • /opt/<app>/conf/*.jks — standard install paths for Tomcat, JBoss, WebSphere, WebLogic
  • /etc/<app>/ssl/*.p12 — common on RHEL/CentOS deployments
  • $JAVA_HOME/lib/security/cacerts — every JDK ships with this; it's the JVM's default trust store, holds ~150 CA certificates
  • Inside WAR files: WEB-INF/classes/keystore.jks, WEB-INF/resources/*.p12 — bundled into the application distribution
  • Inside EAR files: nested WARs, nested JARs, each potentially carrying a keystore
  • Docker image layers: a RUN cp keystore.jks /opt/app/ baked into layer 7 of 12
  • Kubernetes secrets: type: kubernetes.io/tls or type: Opaque with a .p12 payload
  • Config maps containing base64-encoded keystore content
  • Config servers (Spring Cloud Config, HashiCorp Consul KV) distributing keystores to running services
  • Developer laptops: ~/.m2/repository/ with keystores bundled into dependency JARs

Why they're hard to enumerate

No single tool covers all those locations. A find / -name "*.jks" -o -name "*.p12" is a start, but misses keystores inside archives. Decompressing every JAR, WAR, and EAR on every host is expensive. Scanning every running Docker container's layered filesystem is expensive. Scanning every ConfigMap in every Kubernetes cluster is a cross-cluster query.

The complete discovery requires orchestrated tooling across:

  1. Filesystem walks on every production host
  2. Archive inspection — unzip every .jar, .war, .ear and recurse
  3. Container image scanning — static analysis across every layer of every image in the registry
  4. Kubernetes resource inspection — all secrets, configmaps, PVCs in every namespace in every cluster
  5. Running-process introspection — ps + /proc/<pid>/environ to find -Djavax.net.ssl.keyStore=/path/to/keystore arguments, pointing at live keystore paths

TigerTrust's discovery agent does all five. Let me walk through doing it manually first.

Manual Discovery: The Commands

Finding keystore files on disk

bash
1# Common keystore extensions across filesystem 2sudo find / \ 3 \( -name "*.jks" -o -name "*.p12" -o -name "*.pfx" \ 4 -o -name "*.keystore" -o -name "*.truststore" \ 5 -o -name "*.jceks" -o -name "cacerts" \) \ 6 -type f 2>/dev/null

Finding keystores inside archives

bash
1# Every JAR/WAR/EAR, check for embedded keystores 2for archive in $(find / \( -name "*.jar" -o -name "*.war" -o -name "*.ear" \) -type f 2>/dev/null); do 3 if unzip -l "$archive" 2>/dev/null | grep -qE "(\.jks|\.p12|\.pfx|keystore|cacerts)"; then 4 echo "KEYSTORE INSIDE: $archive" 5 fi 6done

Finding keystore references in running JVMs

bash
1# Every Java process, extract its keystore arguments 2for pid in $(pgrep java); do 3 tr '\0' '\n' < /proc/$pid/cmdline | grep -E "keyStore|trustStore" 4done 5 6# JVMs that read keystore paths from env rather than -D args 7for pid in $(pgrep java); do 8 tr '\0' '\n' < /proc/$pid/environ | \ 9 grep -E "KEYSTORE|TRUSTSTORE|KEY_STORE|TRUST_STORE" 10done

Enumerating a keystore's contents

bash
1# JKS and PKCS#12 — keytool handles both 2keytool -list -v -keystore /path/to/keystore -storepass <password> 3 4# Extract individual certificates 5keytool -exportcert -rfc -alias <alias> -keystore /path/to/keystore \ 6 -storepass <password> -file /tmp/cert-<alias>.pem 7 8# PKCS#12 with OpenSSL (useful when you don't have keytool) 9openssl pkcs12 -in keystore.p12 -nokeys -clcerts -passin pass:<password> | \ 10 openssl x509 -text -noout

For Kubernetes-hosted keystores

bash
1# Enumerate every TLS secret containing PKCS#12 2kubectl get secrets --all-namespaces -o json | \ 3 jq -r '.items[] | select(.data | has("keystore.p12") or has("keystore.jks")) | 4 "\(.metadata.namespace)/\(.metadata.name)"' 5 6# Extract the keystore for inspection 7kubectl get secret -n <ns> <name> -o json | \ 8 jq -r '.data["keystore.p12"]' | base64 -d > /tmp/keystore.p12 9keytool -list -keystore /tmp/keystore.p12 -storetype PKCS12

The Password Problem

Every keystore is encrypted with a password. Your discovery is only useful if you can read the keystore — which means you need the password. Password sources, in order of how operators actually store them:

  1. Hardcoded in config files — the server.xml, standalone.xml, application.yml that references the keystore also contains the password
  2. Environment variables — -Djavax.net.ssl.keyStorePassword=<value> on the process command line, or in a pod spec
  3. Secrets managers — HashiCorp Vault, AWS Secrets Manager, Azure Key Vault
  4. Password files — a .keystore.pw next to the keystore (bad practice but common)
  5. Lost to time — the password was set by someone who has left

For discovery purposes, parse config files alongside keystore enumeration; correlate on filename. For keystores where the password is truly lost, you can read the public certificate (keytool -list without -storepass reveals aliases but won't export certs) by walking the ASN.1 directly — the certificate structure in PKCS#12 has recoverable public portions even without the password, though you lose the chain binding.

Expiry and Renewal Pain Points

Once discovered, the renewal pattern for Java keystores is distinctly worse than for file-based PEM certificates:

No native ACME support

Java's TLS infrastructure doesn't have a built-in ACME client. Renewal pipelines typically:

  1. External ACME client (acme.sh, certbot, cert-manager) issues the cert to disk
  2. Wrapper script constructs a new keystore from the issued cert and private key
  3. Service is restarted (or reloads the keystore if the application supports hot-swap, which most JVMs don't)

The third step is where this goes wrong. Many production Java deployments can't hot-reload keystores and require a service restart to pick up a new cert. At 100-day cadence, that's 3-4 scheduled downtime windows per service per year.

Keystore construction brittleness

Converting PEM to PKCS#12 requires knowing the correct alias, chain order, friendly name, encryption algorithm, and whether to include CA certs. Each step has traps:

bash
1# Minimum viable conversion 2openssl pkcs12 -export \ 3 -in cert.pem \ 4 -inkey key.pem \ 5 -certfile fullchain.pem \ 6 -name myservice \ 7 -out myservice.p12 \ 8 -password pass:<newpassword>

Common failures: wrong chain order (leaf must precede intermediates must precede root), wrong friendly name (Java looks up by alias — if the application has myservice hardcoded and your keystore uses server, the application can't find it), mismatched encryption algorithm (some PKCS#12 readers can't handle the modern AES-256 -keypbe default).

Truststore separation

Java distinguishes keyStore (certificates + private keys this service presents) from trustStore (CA certificates this service accepts from peers). Operators sometimes conflate them and put the CA chain in the keystore, breaking mTLS validation.

The clean pattern:

  • keystore.p12 — holds the service's own identity (private key + cert chain)
  • truststore.p12 — holds CA certs this service trusts peers under

Both can be the same file in simple setups, but the architectural separation is worth preserving.

The 100-Day Deadline Angle

With the CA/B Forum's 100-day cap landing on 15 March 2027, every forgotten Java keystore is a scheduled outage. Specifically:

  • A keystore with a 398-day cert issued today will be renewed into a 100-day cert on next rotation. Automation that assumed annual renewal starts failing.
  • Services that currently restart quarterly for cert renewal will restart every 3-4 weeks. That's no longer "a weekend maintenance window" — it's a continuous-operations problem.
  • Services with manual renewal processes (operations engineer runs a script, SRE verifies, service restarts) can't be run manually at 3-4x the cadence. Automation becomes mandatory.

The specific migration ahead of 15 March 2027: any production Java service presenting a public-trust TLS cert needs to be moved onto a fully-automated renewal pipeline. Either:

  1. Migrate the service to a modern TLS-terminating proxy (Envoy, NGINX, HAProxy) that has native ACME, and have Java accept TLS from localhost.
  2. Keep Java terminating TLS, but automate the keystore construction and service restart.

Option 1 is usually better. Option 2 is what you do when option 1 isn't available.

How TigerTrust Automates This

TigerTrust's agent-based discovery covers Java keystores specifically:

  • Filesystem scan across every production host, identifying .jks, .p12, .pfx, and cacerts files
  • Archive inspection — unzips every JAR/WAR/EAR and surfaces embedded keystores
  • Running-process introspection — correlates -Djavax.net.ssl.keyStore= arguments with disk paths to confirm which keystores are actually loaded
  • Kubernetes secrets discovery — scans every secret for base64-encoded keystore blobs
  • Expiry correlation — every discovered cert is cross-referenced against the renewal pipeline; keystores whose certs expire soon but have no matching renewal are flagged
  • Keystore construction automation — for workspaces where TigerTrust also issues the certs, the agent rebuilds keystores on renewal and restarts the service with the configured strategy

The combination means Java keystore certs land in the same inventory as every other cert — searchable, expiry-tracked, renewal-planned.

Related Reading

TOPICS

Java
keystore
JKS
PKCS#12
certificate discovery
mTLS
100-day certificates
TigerTrust

SHARE THIS ARTICLE

Related articles

Incident Analysis

Microsoft Removed All eMudhra Roots: What Breaks on Windows and Edge

On 16 November 2026, Microsoft pulled all 10 eMudhra root certificates from the Windows Trusted Root Store. Unlike Chrome and Firefox's earlier blocks — which only targeted the eight weak-key intermediates — Microsoft's removal un-trusts every certificate chaining through any eMudhra root. That breaks production TLS and code signing on Windows today, not at next renewal. Here's the full impact and the specific remediation path.

11 min read
Email Security

S/MIME Certificate Management for Enterprises: Automating Email Signing and Encryption

S/MIME certificates sign and encrypt employee email at the message level — authenticating senders, protecting content, and anchoring compliance workflows. The CA/Browser Forum's S/MIME Baseline Requirements (effective September 2023, tightened in 2026) put S/MIME under the same lifetime-reduction pressure as TLS. Here's the architecture, the renewal pattern, and the specific automation that makes enterprise S/MIME survive 100-day validity.

13 min read
Post-Quantum

Cryptographic Bill of Materials (CBOM): How to Inventory Your Crypto Before Post-Quantum Migration

You cannot migrate what you cannot enumerate. A Cryptographic Bill of Materials (CBOM) is the full, machine-readable inventory of every cryptographic primitive, certificate, key, and algorithm running in your estate. Here's what a CBOM contains, the CycloneDX 1.6 schema that standardises it, and the specific steps to build one before CNSA 2.0 and the 2030-2035 PQC deadlines land.

14 min read

Ready to Transform Your Certificate Management?

See how TigerTrust can help you automate certificate lifecycle management at scale.