cheat-sheets

Certutil

certutil is a Windows command-line tool for managing certificates and certificate stores. Run from an elevated prompt for machine-wide changes. For cross-platform work see OpenSSL, and for background see TLS (Transport Layer Security) and SSL Certificates Cheat-Sheet.

Trusted Root Store #

COMMANDDESCRIPTION
certutil -addstore -f "ROOT" new-root-certificate.crtAdd a root certificate
certutil -delstore "ROOT" serial-number-hexDelete a root certificate by serial number
certutil -store ROOTList the root store
certutil -store ROOT "<SERIAL-OR-NAME>"Show one certificate
certutil -addstore -f "CA" intermediate.crtAdd an intermediate CA
certutil -user -addstore "ROOT" cert.crtAdd to the current user store only

Common store names: ROOT (Trusted Root CAs), CA (Intermediate), My (Personal), TrustedPublisher, AuthRoot. Add -user for the user store, -enterprise for the enterprise store.

Inspect and Verify #

COMMANDDESCRIPTION
certutil -dump cert.crtShow certificate details
certutil -verify -urlfetch cert.crtVerify the chain and fetch revocation info
certutil -hashfile file.exe SHA256File hash (also MD5, SHA1, SHA512)
certutil -store MyList personal certificates

PFX and Key Material #

COMMANDDESCRIPTION
certutil -importpfx cert.pfxImport a PFX
certutil -exportPFX -p "<PASSWORD>" My <SERIAL> out.pfxExport a certificate with its key
certutil -repairstore My <SERIAL>Repair the key association

Encoding and Conversion #

COMMANDDESCRIPTION
certutil -encode in.bin out.b64Base64 encode a file
certutil -decode in.b64 out.binBase64 decode a file
certutil -encodehex in.bin out.hexHex encode
certutil -decodehex in.hex out.binHex decode

Network #

COMMANDDESCRIPTION
certutil -urlcache -split -f <URL> <FILE>Download a file (often flagged by security tools, prefer curl.exe or Invoke-WebRequest)
certutil -URL <URL>Open the URL retrieval tool
certutil -pingTest connectivity to a CA

PowerShell Equivalents #

powershell
Import-Certificate -FilePath .\root.crt -CertStoreLocation Cert:\LocalMachine\Root
Get-ChildItem Cert:\LocalMachine\Root | Select Subject, Thumbprint, NotAfter
Get-ChildItem Cert:\LocalMachine\My | Where NotAfter -lt (Get-Date).AddDays(30)
Remove-Item Cert:\LocalMachine\Root\<THUMBPRINT>

See PowerShell Cheat-Sheet.

Search all sheets

Tip: / or Ctrl/Cmd+K to open, Esc to close.