Back to Blog

mTLS Certificate Rotation Without Breaking Bank API Connections

5 min read

By OpenFinanceTools · Updated

Separate the certificate from the authorization state

Replacing a client certificate is not always a file-copy operation. Your application may have an existing TLS connection, a token bound to the old certificate, and a provider registration that does not yet accept the replacement. Updating only one of these can produce confusing failures even when the new certificate is valid.

This guide is an operational design for a controlled rotation. It does not prescribe a universal bank procedure: registration rules and overlap periods differ. The goal is to prepare the questions, evidence and rollback steps before the old certificate expires. Always rehearse with the provider’s supported sandbox process.

RFC 8705 distinguishes mutual-TLS client authentication from certificate-bound access tokens. A token can carry a confirmation value identifying the client certificate’s SHA-256 thumbprint. A resource server checks that binding against the certificate presented by the client. A replacement certificate therefore does not automatically work with a token issued against its predecessor.

Keep a simple inventory with certificate fingerprint, environment, registration identifier, issuing chain, expiry, key location and responsible team. Record which endpoints use mTLS and which tokens are bound to the certificate. Signing keys used for client assertions may have their own rotation process; do not assume the same change updates both.

Prepare the new identity before switching traffic

Generate and protect the replacement key through your organization’s approved key-management process. Request the certificate with the provider’s required subject and usage attributes. Confirm the certificate and key belong together, inspect the chain, and confirm the environment and hostname expectations. Avoid moving production private keys into browser tools or support tickets.

Use the CSR decoder and PEM decoder with synthetic or non-sensitive public material to inspect structure. A readable certificate is not proof of trust, registration or authorization. The certificate monitoring guide explains a complementary set of expiry and TLS checks.

Ask the provider whether both certificates can be registered simultaneously, how long registration propagation takes, and how removal is confirmed. If overlap is not supported, plan an explicit coordinated cutover instead of claiming a zero-downtime rotation. Record the provider’s answer and test the sequence that answer permits.

Understand why an old token fails with a new certificate

Imagine token A was issued while the client presented certificate A. The client then switches its HTTPS agent to certificate B but retains token A in a cache. The TLS handshake may succeed because B is registered, yet the resource request can fail because the token still refers to A.

The local example models this one comparison. It uses synthetic byte strings in place of DER certificates, calculates their SHA-256 thumbprints and checks old/new combinations. It deliberately performs no TLS handshake and validates no token signature. In a real implementation, the certificate bytes come from the authenticated TLS connection, and the confirmation claim must come from a validated token or trusted introspection response.

Run the exercise to see that a matching pair succeeds and a cross-pair fails. The lesson is to manage token and certificate selection together. It is not permission to trust a client-supplied certificate header or an unverified JWT claim.

Download the runnable exercise

node mtls-binding-lab.mjs
View the complete exercise
import assert from 'node:assert/strict';
import { createHash, timingSafeEqual } from 'node:crypto';
// Synthetic bytes stand in for DER certificates. No TLS handshake is performed.
const thumbprint = der => createHash('sha256').update(der).digest('base64url');
function matches(bound, presented) {
  const expected = Buffer.from(bound, 'base64url');
  const actual = createHash('sha256').update(presented).digest();
  return expected.length === actual.length && timingSafeEqual(expected, actual);
}
const oldCertificate = Buffer.from('synthetic-old-certificate');
const newCertificate = Buffer.from('synthetic-new-certificate');
assert.equal(matches(thumbprint(oldCertificate), oldCertificate), true);
assert.equal(matches(thumbprint(oldCertificate), newCertificate), false);
assert.equal(matches(thumbprint(newCertificate), newCertificate), true);
assert.equal(matches(thumbprint(newCertificate), oldCertificate), false);
assert.equal(matches('', newCertificate), false);
console.log('5 certificate binding checks passed');

Use an explicit overlap sequence

  1. Register certificate B using the provider’s approved procedure and confirm acceptance.
  2. Create a separate connection pool configured with B. Leave pool A available for operations that still require it.
  3. Obtain a fresh token using the required client authentication and binding configuration for B.
  4. Call a harmless resource with the B token/B certificate pair and inspect the actual response.
  5. Move a small cohort to B, keeping token caches partitioned by credential generation.
  6. Drain A connections and operations according to the documented lifetime and rollback policy.
  7. Remove A from provider registration and key storage only when the retirement criteria are met.

These steps are a proposed runbook, not a requirement that every provider offers dual registration. Where the provider does not permit overlap, replace the sequence with a scheduled cutover and a tested recovery procedure.

Connection pooling matters because changing a file on disk does not necessarily rebuild an existing TLS connection. Make the credential generation explicit in the client configuration and restart or replace pools through a controlled deployment. Confirm which generation actually handled the test request rather than relying on a deployment timestamp.

Diagnose by stage rather than by a generic error message

Failure stageCheck firstUseful evidence
TLS handshakeChain, key match, accepted issuer and client certificate requestHandshake error category and public fingerprint
Token issuanceRegistration, authentication method, endpoint and client identitySanitized OAuth error and correlation ID
Resource accessToken/certificate pairing, audience, scope and consentCredential generation and response category
Intermittent errorsMixed deployment instances or old connection poolsInstance version and pool generation

Do not log private keys, tokens or full authorization headers to troubleshoot. A public certificate fingerprint and a credential-generation identifier normally provide a safer way to connect events. Keep diagnostics access-controlled because even metadata can reveal customer activity.

A successful token request does not prove resource access, and a successful resource read does not prove payment permissions. Test the specific journeys you operate, including revoked consent and expired credentials. A negative test should fail at the expected stage; an unexpected success deserves investigation.

Define when rollback is safe

Rollback to A is possible only while A remains valid and accepted, and only for operations whose authorization context can still use it. Do not move an existing B-bound token onto pool A. Choose a matched credential/token pair or repeat the approved token acquisition flow. Treat an ambiguous payment outcome as a reconciliation problem, not as a reason to resubmit through another certificate.

Set retirement criteria in advance: no active A-dependent operations, no required A-bound token use, completed provider deregistration, and confirmation that scheduled workloads run on B. If an old key may be compromised, incident response takes precedence over a comfortable overlap window.

Rehearse rotation on a calendar rather than discovering the process during an expiry incident. Keep a dated record of tests, provider responses, rollback results and owner sign-off. This turns the next renewal into a repeatable operational change instead of a one-off debugging exercise.

Method and scope

Prepared 21 October 2026. This AI-assisted guide combines cited technical references with an illustrative engineering workflow. Its synthetic Node.js exercise is checked in the project test suite. It is not evidence of a live bank integration or certification.

Published by OpenFinanceTools. Testing, sources and corrections