How to Replace an Expired or Compromised Code Signing Certificate

Replacing a code signing certificate is not always the same process. A normal expiration is a planned certificate transition. A compromised private key is a security incident that requires containment, investigation, and a new signing key.

Starting pointOld certificate
Expired or no longer trusted
→
DecisionWhy is it being replaced?
Expiration, compromise, loss, or another change
→
DestinationNew signing workflow
New certificate, tested and ready for release

The replacement path changes substantially when the private key itself is no longer trustworthy.

Start by identifying the replacement scenario

The safest way to replace an old certificate is to decide first what happened to it. An expired certificate can often follow a normal certificate acquisition process. A compromised certificate needs incident response because the private key may have escaped the publisher's control.

Normal expiration

The certificate reached the end of its validity period. If the private key remains trustworthy, the organization can obtain a current certificate and transition its signing workflow.

New certificate → configure → test → production

Private-key compromise

The signing secret may have been copied or signing access may have been abused. Stop signing, investigate, follow the CA's revocation process, generate a new key, and rebuild the signing path.

Stop → investigate → revoke → new key → recover
REPLACEMENT DECISION The reason for replacement determines the recovery path OLD CERTIFICATE Why is it being replaced? NORMAL EXPIRATION New certificate configure → test → production PRIVATE-KEY COMPROMISE Contain and rebuild stop → investigate → revoke → new key same certificate? no automatic assumption

Expired, revoked, lost, or compromised: the paths are different

Certificate replacement should not be treated as a single procedure. The status of the certificate and the trustworthiness of the private key determine what needs to happen next.

SituationOld certificateOld private keyMain action
Normal expirationNo longer valid for new signingMay still be under publisher controlObtain a new certificate
Revoked for another reasonNo longer trustedMay still be controlledFollow the CA's replacement process
Private key compromisedMust be treated as unsafeUntrustedNew key and new certificate
Private key lostCertificate may still existInaccessibleGenerate a new key and obtain a new certificate
Signing system compromisedStatus needs investigationPotentially exposedInvestigate signing access before recovery

Assess the signing environment before making changes

A certificate rarely exists in only one place. Before removing an old certificate, map where it is used and establish why it is being replaced. Record the certificate identity, issuer, certificate type, serial number, thumbprint, expiration date, associated key, signing tools, timestamp configuration, and any automated systems that reference it.

CertificateRecord the publisher, issuer, type, serial number, thumbprint, and dates.
KeyDetermine where the private key is held and whether it can still be trusted.
WorkflowFind local machines, signing servers, HSMs, cloud services, CI/CD jobs, secrets, and release scripts.

Replacing a normally expired certificate

When a certificate simply reaches the end of its validity period, replacement is primarily a transition to a current certificate for future signing. The old certificate can remain useful for examining historical signatures, release records, and previous builds, so avoid deleting evidence before the new workflow has been verified.

01Confirm expiration and record certificate details.
03Generate or provision the signing key as required.
04Complete validation and receive the replacement certificate.
05Configure, test, then move the new workflow into production.
EXPIRATION WORKFLOW 01Confirm expiryrecord certificate data 02Obtain new certvalidate + provision 03Configurelocal, HSM, cloud or CI 04Test signingverify certificate + chain 05Releaseproduction signing
Expiration normally follows a controlled replacement path. The key question is whether the private key remains trustworthy.

Check the old certificate before removing it

Record the details that identify the old certificate and its signing environment. This matters when an organization has several certificates, several signing machines, or more than one release pipeline. The old certificate's thumbprint or serial number can also become a useful reference when checking that automation has stopped selecting it.

CertificatePublisher and issuer
IdentitySerial and thumbprint
KeyAssociated signing key
UsageMachines and pipelines
EvidenceTimestamp and release records

Obtain the replacement certificate

The replacement should match the publisher and signing requirements unless the organization is intentionally changing its identity or certificate profile. The general transition is straightforward: select the appropriate certificate, complete the required CA validation, generate or provision the key, receive the certificate, and associate it with the intended signing environment.

01Choose certificate
02Validate identity
03Provision key
04Receive certificate
05Install or provision

Compare code signing certificate options

Choose a certificate that fits your publisher identity, release requirements, and signing environment before moving the replacement into production.

Compare certificatesOpen the buying guide

Should the private key change when a certificate expires?

For a normally expired certificate, the old private key may not have been compromised. Whether it can be reused depends on the CA's current requirements and the signing environment. Generating a new key is often a clean way to establish the new certificate, but the governing certificate requirements and provider workflow should decide the actual process.

That answer changes completely after a private-key compromise. A compromised key should not be reused for a replacement certificate because the problem is the secrecy of the key itself, not the metadata in the certificate.

Normal expiration

Old key may remain trustworthy
→

Compromise

Old key = permanently untrusted

Install or provision the new certificate across the signing stack

The certificate has to reach the system that actually performs signing. For local signing, that means the signing tool must be able to access the matching key. For an HSM, the certificate must be associated with the intended protected key. For cloud signing, the service and signing policy must point to the new certificate. Dedicated signing servers and CI/CD systems need their certificate references and credentials updated as well.

Local: certificate + matching key + signing tool

HSM: certificate + protected key + authorized signing operation

Cloud: certificate + protected signing service + authorized identity

CI/CD: certificate reference + credentials + signing configuration

Test the new signing workflow before production

Installing a certificate is not the same as replacing a signing workflow. A controlled test should prove that the intended certificate is actually used, that the resulting signature verifies, and that the release environment behaves as expected.

ArtifactTest file
SigningCreate signature
VerificationValidate signature
TrustInspect chain and publisher
TimeCheck timestamp
ReleaseTest target platform and CI/CD

When a private key is compromised, stop treating it as a normal replacement

A compromised signing key changes the objective from certificate maintenance to incident containment. Stop signing with the affected key, restrict access to the signing environment, preserve relevant evidence, determine the likely compromise window, and contact the issuing CA to follow its compromise and revocation process.

ContainStop signing
InvestigatePreserve evidence
CertificateFollow CA revocation process
RecoverGenerate new key
RebuildNew certificate and signing path
ResumeTest and release
COMPROMISE RESPONSE Do not move directly from “old” to “new” 01STOPaffected signing 02CONTAINaccess + credentials 03INVESTIGATEscope + signing window 04REVOKECA process 05REBUILDnew key + certificate
A compromised key changes the task from routine replacement to incident response and recovery.

Why a compromised private key must not be reused

Once an attacker has copied a private key, the publisher cannot reliably make that same key secret again. Removing it from one computer, changing a password, reinstalling a certificate, or revoking the certificate does not prove that every copy has disappeared.

The recovery principle is therefore simple: a compromised private key is no longer a trusted signing secret. The replacement process needs a new key pair, not merely a new certificate wrapped around the old key.

Revoke the certificate through the issuing CA

When private-key compromise is confirmed or reasonably suspected, the certificate may need to be revoked. The publisher should follow the issuing CA's process rather than assuming revocation is a local switch. Revocation communicates a changed trust status for the certificate, while the compromised private key itself remains compromised.

IncidentPrivate key compromise
ActionStop signing
CARevocation process
ReplacementNew key and certificate

Generate a completely new key pair

The replacement key must be cryptographically distinct from the compromised one. Think of the transition as two separate pairs rather than one certificate being swapped over an unchanged secret.

Old signing identity

Private Key A
Public Key A
→

Replacement signing identity

Private Key B
Public Key B

The new certificate is issued for the new signing key. This breaks the cryptographic relationship with the compromised secret.

Obtain the replacement certificate after compromise

Once the new key has been generated or provisioned, complete the appropriate certificate request and validation process. The new certificate should be checked for the expected publisher identity, certificate profile, validity period, and public-key association. For a compromised certificate, this is a recovery process rather than simply an ordinary renewal.

KEY REPLACEMENT A new certificate should follow a newly established signing key OLD IDENTITY Private Key A no longer trusted after compromise RETIRE NEW MATERIAL Key Pair B fresh private + public key REPLACEMENT IDENTITY New certificate bound to the new public key Changing certificate metadata does not make a leaked private key secret again.

Replace the certificate throughout CI/CD

Automated signing is a common place for incomplete replacements. Updating the certificate on one developer machine does not fix a release pipeline that still references the old certificate or its credentials.

ReferencesCertificate identifiers, thumbprints, signing scripts, build configuration, and containers.
AccessSecret stores, service accounts, API credentials, HSM access, cloud tokens, and environment variables.
ReleaseBuild agents, signing servers, deployment workflows, release jobs, and secondary environments.

After the changes, run a controlled build and inspect the resulting signature. The goal is to prove that the new workflow is signing the artifact, not simply that the new certificate exists somewhere in the environment.

Previously signed software needs separate evaluation

Replacing a certificate primarily changes future signing. It does not automatically mean that every previously released file must be re-signed. Historical software needs to be evaluated according to why the certificate was replaced, when each file was signed, whether a trusted timestamp is present, whether unauthorized software may have been produced, and how the relevant platform verifies signatures.

Before expirationLegitimate software may have been signed while the certificate was valid.
After expirationNew signing requires a current certificate.
Before compromiseSoftware may predate the incident.
Compromise windowSignatures require investigation against logs and release records.
After compromiseSignatures made with the compromised authority should be treated as potentially unauthorized.

A trusted timestamp can provide evidence about when a signature existed. It does not prevent a key compromise or automatically settle every post-compromise verification question.

CI/CD REPLACEMENT Replacing the certificate means updating the signing path, not just one file BUILDSourcerelease candidate SIGNING CONFIGNew certnew credentials SIGNProtected keyHSM or cloud VERIFYSignaturechain + timestamp RELEASEProductionold cert no longer selected

Replacing a certificate does not automatically mean re-signing everything

The new certificate is normally intended for future releases. Previously released software may continue to have historical signatures that need to be verified on their own terms. A publisher should decide whether re-signing is necessary based on the circumstances of the replacement and the integrity of the affected releases.

In a compromise scenario, the question is broader than certificate age. The publisher needs to determine whether unauthorized files were signed and distributed during the suspected compromise window.

HISTORICAL RELEASES The replacement event does not erase the history of earlier signatures BEFORE INCIDENTlegitimate releasetimestamp may establish signing time SUSPECTED WINDOWinvestigate signaturescompare hashes + release records AFTER RECOVERYnew key + certificatefuture releases use new signing path

Keep the old certificate available for investigation and records

Removing an old certificate from active signing configuration does not mean erasing its history. Certificate details can remain relevant when examining existing software, validating release records, investigating an incident, or explaining a historical signature to customers and auditors.

The practical goal is to remove the old certificate from active signing paths while preserving the information needed to understand software that was signed in the past.

Replacing a certificate in an HSM

An HSM changes how the signing key is protected, but the replacement still needs a controlled certificate and authorization transition. If the key is non-exportable and remains protected, an incident may involve compromised signing credentials or authorization rather than extraction of the private key itself. That distinction should be established during investigation.

Old stateExisting key and certificate
RetireDisable affected configuration
ProvisionGenerate protected new key
IssueNew certificate
AuthorizeControlled signing access
VerifyTest before production

Replacing a certificate in a cloud signing service

Cloud signing introduces another boundary: the signing operation may be remote, while the private key remains inside the service's protected environment. Replacement therefore involves certificate provisioning, key handling where applicable, signing policies, identities, API credentials, tokens, service accounts, audit records, and CI/CD integration.

If the cloud account or signing authorization was compromised, replacing the certificate alone is insufficient. The access path that allowed unauthorized signing must also be contained and rebuilt.

What if the old private key is lost?

A lost private key is different from a compromised key, but it still prevents the publisher from continuing to use that key when the signing operation requires it. A public certificate cannot be used to recreate the original private key. Generate a new key pair, obtain a new certificate, and update the signing infrastructure for future releases.

Check whether publisher information has changed

Certificate replacement can also expose an identity change. Before submitting the new certificate request, check whether the legal organization name, address, organizational structure, or publisher status has changed. A merger, acquisition, reorganization, or change from individual publishing to organizational publishing can affect CA validation and the appropriate certificate process.

Verify the replacement from certificate to release

A successful replacement should be demonstrated through the complete signing path. Do not stop at certificate installation. Verify the certificate, signature, trust chain, timestamp, platform behavior, and automated release process.

Certificate and signature

Expected publisher✓
Correct certificate profile✓
Valid key association✓
Signature verifies✓
Chain builds correctly✓

Release environment

Timestamp behaves as intended✓
Target platform recognizes signature✓
CI/CD signs successfully✓
Release artifact verifies✓
Old certificate is no longer selected✓

Confirm that the old certificate is no longer active

After the new workflow works, search the environments that can still sign software. Check build scripts, CI/CD configuration, secret stores, signing servers, HSM configuration, cloud signing configuration, developer machines, and release automation. Search for the old certificate's thumbprint or other stable identifier where appropriate.

SearchFind old certificate references
TraceIdentify active signing paths
RemoveRetire obsolete configuration
TestConfirm new certificate signs
RecordDocument the new key/certificate pair
REPLACEMENT VERIFICATION Verify the actual release path, not only the certificate installation CERTIFICATECorrect publisherdates + key association SIGNATUREValid signaturechain + timestamp AUTOMATIONCI/CD uses new certold thumbprint absent RELEASEGoproduction

A practical replacement checklist

For a normal expiration, the work is primarily certificate transition and verification. For compromise, the first priority is containment and evidence preservation.

Expired certificateCompromised certificate
Confirm expirationStop signing immediately
Record old certificate detailsRestrict signing access
Check private-key statusPreserve logs and evidence
Review current CA requirementsDetermine the compromise window
Generate or provision key as requiredIdentify affected releases
Obtain replacement certificateContact CA and follow revocation process
Update signing tools and CI/CDGenerate a completely new key pair
Test signature, chain, timestamp, and platformObtain replacement certificate and rebuild signing access
Confirm old certificate is not selected accidentallyUpdate CI/CD and investigate previous signatures
Move verified workflow to productionResume production only after controlled testing

Common mistakes during certificate replacement

01
Treating a compromised certificate like an ordinary expiration.
02
Reusing a private key that has been compromised.
03
Replacing the certificate while leaving old signing credentials active.
04
Updating one machine but forgetting CI/CD, secondary signing servers, HSMs, or cloud access.
05
Failing to investigate signatures created during a suspected compromise window.
06
Assuming every old signature becomes invalid, or assuming every old signature is automatically safe.
07
Testing certificate installation instead of testing an actual signed release artifact.
08
Leaving the old certificate available to automated signing after production has moved to the replacement.

Choose a certificate for your signing workflow

Review available certificate options and confirm the validation and key protection requirements before placing an order.

Explore certificates

Code signing certificate replacement FAQs

How do I replace an expired code signing certificate?

Confirm the expiration, review current CA requirements, obtain a current certificate, provision it in the signing environment, update signing tools and automation, and verify an actual signed artifact before production use.

How do I replace a compromised code signing certificate?

Stop signing with the affected key, contain the signing environment, preserve evidence, investigate the compromise, contact the issuing CA, follow its revocation process, generate a new key pair, obtain a replacement certificate, and rebuild the signing workflow.

Do I need a new private key when replacing a certificate?

Not necessarily for an ordinary expiration, because the old key may remain trustworthy and reuse may depend on current requirements. A compromised private key should not be reused.

Can I reuse a compromised private key with a new certificate?

No. If the key has escaped control, changing the certificate does not make the private key secret again. Generate a new key pair.

Should a compromised certificate be revoked?

A confirmed or reasonably suspected private-key compromise generally calls for contacting the issuing CA and following its compromise and revocation procedure.

Do I need to re-sign software after replacing a certificate?

Not automatically. Replacement is primarily for future signing. Previously signed software should be evaluated according to its signing time, timestamp evidence, compromise circumstances, and relevant verification behavior.

What happens to software signed with the old certificate?

Its historical signature remains a separate verification question. Preserve certificate and release records and investigate files affected by a compromise rather than assuming every old file is either invalid or safe.

How does timestamping affect previously signed software?

A trusted timestamp can provide evidence that a signature existed at a particular time. It does not prevent key compromise and does not automatically resolve every verification question after compromise.

What if I lost the private key?

You cannot recreate the original private key from the public certificate. Generate a new key pair, obtain a new certificate, and update the signing environment.

How do I verify that the new certificate is being used?

Sign a controlled test artifact and inspect its certificate, signature, chain, timestamp, publisher information, and CI/CD result. Also check that the old certificate is no longer selected by active signing configuration.

The replacement process has one critical fork

Certificate replacement becomes much safer when the first question is not “How do I install the new certificate?” but “Why am I replacing the old one?” Normal expiration leads to a controlled certificate transition. Private-key compromise requires containment, investigation, revocation, a new key, and a rebuilt signing path.

Why replace?→Expired→New certificate→Configure→Test→Production Compromised→Stop→Investigate→Revoke→New key→New certificate→Test→Production