certz trust -- Reference

February 23, 2026 ยท View on GitHub

Add and remove certificates from the Windows certificate trust store. Adding a CA to the Root store causes Windows and all browsers to trust every certificate that CA has signed.

See also: Windows Trust Store | Certificate Chain | Exit Codes

Security warning: Only add CAs you control or explicitly trust to the Root store. A trusted Root CA can issue certificates for any domain. A compromised or malicious CA can silently intercept HTTPS traffic. See Windows Trust Store for a full explanation of the trust model.


trust add

Add a certificate to the Windows trust store.

Quick Examples

# Add a CA certificate to the Root store (CurrentUser)
certz trust add ca.cer --store Root

# Add from a PFX file
certz trust add ca.pfx --password MyPassword --store Root

# Add to LocalMachine (requires Administrator)
certz trust add ca.cer --store Root --location LocalMachine

# Add to the Intermediate CA store instead of Root
certz trust add intermediate.cer --store CA

Auto-location Default

When certz trust add is run as Administrator, the default location is LocalMachine (machine-wide trust, no UI dialog). When run as a standard user, the default is CurrentUser (trust for the current user only).

You can always override this with --location:

# Force CurrentUser even when running as admin
certz trust add ca.cer --store Root --location CurrentUser

# Force LocalMachine (will fail without admin rights)
certz trust add ca.cer --store Root --location LocalMachine

trust add Options

OptionDefaultDescription
<file>(required)Certificate file to add: PFX, PEM, DER, or CER
--password, -p(none)Password for PFX files. Also reads from CERTZ_PASSWORD env var.
--store, -sRootTarget store: Root, CA, My, TrustedPeople
--location, -lLocalMachine (admin) or CurrentUserStore location: CurrentUser or LocalMachine
--dry-run, --drfalseShow where the certificate would be added without modifying the store.
--formattextOutput format: text or json

trust remove

Remove certificates from the Windows trust store by thumbprint or subject pattern.

Quick Examples

# Remove by full thumbprint (40 hex chars) -- no confirmation prompt with --force
certz trust remove ABC123DEF456789012345678901234567890ABCD --force

# Remove by partial thumbprint (8+ chars prefix match) -- interactive confirmation
certz trust remove ABC123DE

# Remove by subject pattern (wildcards supported)
certz trust remove --subject "CN=Dev CA*" --force

# Remove from a specific store and location
certz trust remove ABC123DEF456 --store Root --location LocalMachine --force

Partial Thumbprint Matching

You can provide a shortened thumbprint prefix instead of the full 40-character value.

Rules:

  • Minimum 8 characters required (shorter values are rejected)
  • Matching is case-insensitive prefix match (StartsWith)
  • A full 40-character thumbprint performs an exact match
  • Only hex characters are accepted (0-9, A-F)
  • If multiple certificates match, --force is required; otherwise certz lists the matches and exits without removing anything
# Ambiguous -- lists matches and exits without removing (add --force to proceed)
certz trust remove ABC12

# At least 8 chars required
certz trust remove ABCDE            # error: too short (5 chars)

# Multiple matches found -- certz lists them and exits
certz trust remove ABC123DE         # three certs share this prefix -- add --force

# Multiple matches -- remove all matching
certz trust remove ABC123DE --force

Subject Pattern Matching

Use --subject with wildcard patterns to match by Distinguished Name:

# Remove all Dev CA certs
certz trust remove --subject "CN=Dev CA" --force

# Wildcard match
certz trust remove --subject "CN=Dev*" --force

# Combine with store/location
certz trust remove --subject "CN=My Org*" --store Root --location LocalMachine --force

Interactive Confirmation

When --force is not provided and exactly one certificate matches, certz prompts for confirmation before removing:

Remove certificate 'Dev CA' (ABC123DEF456789012345678901234567890ABCD)?
[y/n] (n):

Type y to confirm, or press Enter to cancel. In JSON output mode (--format json), --force is required to bypass the interactive prompt.

trust remove Options

OptionDefaultDescription
[thumbprint](none)Full (40-char) or partial (8+ char) thumbprint. Required unless --subject is provided.
--subject(none)Remove certificates matching this subject pattern. Wildcards supported.
--store, -sRootTarget store: Root, CA, My, TrustedPeople
--location, -lLocalMachine (admin) or CurrentUserStore location: CurrentUser or LocalMachine
--force, -ffalseRemove without interactive confirmation. Required when multiple certificates match.
--dry-run, --drfalseShow which certificates would be removed without modifying the store.
--formattextOutput format: text or json

Store Names

StoreContainsCommon use
RootTrusted Root CAsAdd self-signed or internal CA certs here to establish trust
CAIntermediate CAsAdd intermediate CA certs here to complete chains
MyPersonal certificates with private keysCerts used by this machine for authentication or TLS
TrustedPeopleUser-trusted certificatesPeer-to-peer trust; less common

Security Notes

What a trusted Root CA can do

When you add a certificate to the Root store:

  • Every certificate signed by that CA is automatically trusted by Windows and browsers
  • The CA can issue certificates for any domain name -- including github.com, google.com, etc.
  • If the CA's private key is stolen, an attacker can issue fraudulent certificates for any site

Only add CAs you generated yourself (via certz create ca) or CAs from organizations you explicitly trust.

CurrentUser vs LocalMachine

LocationWho is affectedRequires admin
CurrentUserOnly the logged-in userNo
LocalMachineAll users on the machineYes (run as Administrator)

For development environments, CurrentUser is sufficient and does not require elevation. Use LocalMachine only when machine-wide trust is needed (e.g., for services running as LocalSystem or in CI agents).


Troubleshooting

ProblemLikely causeFix
"Access denied" when adding to LocalMachineNot running as AdministratorRight-click the terminal and "Run as Administrator", then retry.
Windows security dialog appears when adding to RootAdding to CurrentUser Root store requires user confirmation (Windows security feature)Run as Administrator to add to LocalMachine Root store and bypass the dialog.
"No matching certificates found" on trust removeWrong thumbprint, store, or locationRun certz store list --store Root (and other stores) to find the certificate and confirm its thumbprint.
Thumbprint too short errorFewer than 8 characters providedProvide at least 8 hex characters. Full thumbprint is always safe.
Browser still shows untrusted warning after trust addBrowser certificate cacheClose and reopen the browser. Some browsers (Firefox) use their own trust store -- add the cert via the browser's settings instead.
trust remove lists matches but does not removeMultiple certs matched; --force not providedReview the listed certs, then re-run with --force to remove all matches, or use a longer thumbprint prefix to narrow the match.