All ArticlesSecurity2026-11-15T21:56:40+08:00

Cryptographic Certificate on Your National Data Exchange Expired? Verify Chain of Trust Now

Government agencies exchanging data under Satu Data Indonesia may not notice expired or misconfigured certificates in their national cryptographic infrastructure until integrity checks silently fail. After reading, you will know how to verify certificate validity, chain of trust, and revocation status on inter-agency data exchange endpoints.

Government agencies exchanging data through national platforms — like those built under Indonesia's Satu Data Indonesia initiative — rely on cryptographic certificates to guarantee that documents are authentic, data has not been tampered with, and communications stay confidential between agencies. The problem: certificates expire, intermediate CAs get rotated, and revocation lists go stale. When any of these break, integrity checks can fail silently. No alarm fires. Data just stops being trusted, or worse, gets accepted without proper validation. This guide walks through how to verify certificate validity, chain of trust, and revocation status from the command line, step by step.

Why silent certificate failures happen on data exchange endpoints

A national data exchange platform typically uses a Public Key Infrastructure (PKI) — a hierarchy of certificate authorities (CAs) where a root CA signs intermediate CAs, and those intermediates sign the endpoint (leaf) certificates used by each agency's servers and services.

Three things commonly go wrong:

  1. Leaf certificate expires. The endpoint certificate has a validity period. When it passes, TLS handshakes fail — but if the client application swallows errors or falls back to unverified mode, nobody notices.
  2. Intermediate certificate missing or expired. The server needs to send the full chain (leaf + intermediates) during the TLS handshake. If an intermediate is missing, clients that do not have it cached will reject the connection. Some clients silently skip verification.
  3. Revocation data unreachable. If the OCSP (Online Certificate Status Protocol) responder is down or the CRL (Certificate Revocation List) distribution point is unreachable, clients may soft-fail — meaning they accept the certificate anyway, even if it has been revoked.

In a national data exchange context, these failures are especially dangerous because the whole point of the certificate infrastructure is to ensure data integrity and authenticity between agencies. A silently broken chain of trust defeats that purpose entirely.

Step 1: Pull the certificate and check expiry dates

Connect to the endpoint and retrieve its certificate. Replace data-exchange.example.go.id and the port with the actual hostname and port of the service you need to verify.

# Connect and display the leaf certificate details
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates -serial

Sample output format:

subject=CN = data-exchange.example.go.id
issuer=CN = National Intermediate CA G2, O = National PKI Authority
notBefore=Jan  1 00:00:00 2024 GMT
notAfter=Jan  1 00:00:00 2025 GMT
serial=0A1B2C3D4E5F

What to check:

  • notAfter — if this date is in the past, the certificate is expired. Done. Renew it.
  • notBefore — if this date is in the future, the certificate is not yet valid (clock skew on the server can cause this).
  • issuer — note the issuer CN. You will need this to verify the chain.

To check how many days remain before expiry in a scriptable way:

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -checkend 2592000

The -checkend 2592000 flag checks whether the certificate expires within the next 2,592,000 seconds (30 days). Exit code 0 means it is still valid beyond that window; exit code 1 means it expires within 30 days or is already expired.

Step 2: Verify the full chain of trust

A certificate on its own means nothing. It needs to chain back to a trusted root CA through one or more intermediate CAs. The server should send the full chain during the TLS handshake, but sometimes intermediates are missing.

To see every certificate the server sends:

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -showcerts </dev/null 2>/dev/null

This outputs each certificate in the chain as a PEM block (the text between -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----). Count them. Typically you should see at least two: the leaf and one or more intermediates. The root CA is usually not sent by the server because clients are expected to have it in their local trust store.

To verify the chain against your system's trust store:

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -verify_return_error </dev/null 2>&1 | grep -E 'Verify return code|depth'

What you want to see: Verify return code: 0 (ok). Anything else means the chain is broken. Common error codes:

  • error 10 (certificate has expired) — one of the certificates in the chain is past its notAfter date.
  • error 20 (unable to get local issuer certificate) — the root CA is not in your trust store, or an intermediate is missing from the chain the server sent.
  • error 21 (unable to verify the first certificate) — the server sent only the leaf certificate with no intermediates.

If the national PKI uses a root CA that is not in the default OS trust store (which is common for government-specific CAs), you need to specify the root CA file explicitly:

openssl verify -CAfile /path/to/national-root-ca.pem -untrusted /path/to/intermediate-ca.pem /path/to/leaf-cert.pem

The -CAfile flag points to the trusted root. The -untrusted flag provides intermediates that need to be validated (not blindly trusted). This distinction matters.

Step 3: Check revocation status via OCSP

A certificate might be valid date-wise and chain correctly, but still be revoked — for example, if the private key was compromised. Two mechanisms exist for checking revocation: OCSP and CRL.

First, extract the OCSP responder URL from the certificate:

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -ocsp_uri

This prints a URL like http://ocsp.national-pki.go.id. Then query it:

# Save the leaf and issuer certs first
openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -showcerts </dev/null 2>/dev/null > fullchain.pem

# Extract leaf cert (first PEM block) and issuer cert (second PEM block)
# Then query OCSP
openssl ocsp -issuer issuer.pem -cert leaf.pem -url http://ocsp.national-pki.go.id -resp_text

What you want: leaf.pem: good. If it says revoked, the certificate has been explicitly revoked. If the OCSP responder is unreachable or returns an error, that is a problem in itself — it means revocation checking is not functioning, and clients doing soft-fail OCSP will accept potentially revoked certificates.

You can also check whether the server supports OCSP stapling (where the server fetches and caches the OCSP response, saving the client a round trip):

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id -status </dev/null 2>&1 | grep -A 5 'OCSP Response'

If you see OCSP Response Status: successful, stapling is working. If you see no OCSP response data at all, stapling is not configured on the server.

Step 4: Check the CRL as a fallback

Some national PKI setups rely on CRLs (Certificate Revocation Lists) instead of or in addition to OCSP. Extract the CRL distribution point from the certificate:

openssl s_client -connect data-exchange.example.go.id:443 -servername data-exchange.example.go.id </dev/null 2>/dev/null | openssl x509 -noout -text | grep -A 2 'CRL Distribution'

This gives you a URL. Download the CRL and check whether the certificate's serial number appears on it:

wget -q http://crl.national-pki.go.id/intermediate-g2.crl -O intermediate.crl
openssl crl -in intermediate.crl -inform DER -noout -text | grep -i 'serial\\|last update\\|next update'

Check two things: whether the certificate's serial number is listed (meaning it is revoked), and whether the CRL's "Next Update" date is in the past. A stale CRL means revocation data is no longer current, and any certificate revoked after the last update would not appear on it.

What to do when verification fails

Once you have identified the specific failure, the fix depends on what broke:

Expired leaf certificate — needs renewal by whoever manages the endpoint. In a national PKI context, this typically means submitting a new Certificate Signing Request (CSR) to the issuing authority and installing the renewed certificate on the server.

Missing intermediate — the server administrator needs to configure the web server or application to send the full chain. This is the same problem that causes curl to reject certificates that browsers accept, because browsers cache intermediates and curl does not. For more on that specific behavior, see Why curl Rejects an SSL Certificate That Works in Your Browser.

Untrusted root CA — if the national PKI root CA is not in your system's default trust store, you need to add it manually. On most Linux distributions, this means placing the root CA PEM file in the appropriate directory and running update-ca-certificates (Debian/Ubuntu) or update-ca-trust (RHEL/CentOS). The exact path and command depend on the distribution.

OCSP responder unreachable — this is an infrastructure problem on the CA side. Document it, report it to the PKI operator, and in the meantime, verify revocation via CRL if available. Be aware that if both OCSP and CRL are unreachable, most TLS clients default to soft-fail (accept the certificate anyway), which is a security gap.

Make this a scheduled check, not a one-time thing

Certificates expire on a fixed date. OCSP responders go down. CRLs go stale. None of these announce themselves. The verification steps above work as a one-time audit, but the real value comes from running them on a schedule — a cron job that checks -checkend for upcoming expiry, a monitoring probe that hits the OCSP responder weekly, or a script that compares CRL "Next Update" against the current date.

For agencies participating in national data exchange under frameworks like Satu Data Indonesia, where the cryptographic infrastructure underpins data integrity and authenticity across the entire government, a silently expired certificate is not a cosmetic issue. It means the guarantee that data came from who it claims to come from, and was not modified in transit, is no longer being enforced. Verify the chain of trust now, and set up something that verifies it again next month.