Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hash3liZer/ba88b55ea2b60b1aca27c91f23795ea5 to your computer and use it in GitHub Desktop.
Save hash3liZer/ba88b55ea2b60b1aca27c91f23795ea5 to your computer and use it in GitHub Desktop.
Installing Mitmproxy certificate into Windows from command line

Installation

Tried these commands and none of them worked?

$ certutil.exe -addstore root .\mitmproxy-ca-cert.p12
root "Trusted Root Certification Authorities"
CertUtil: -addstore command FAILED: 0x80092009 (-2146885623 CRYPT_E_NO_MATCH)
CertUtil: Cannot find the requested object.
$ certutil.exe -ImportPfx "TrustedRootCA" .\mitmproxy-ca-cert.p12
Enter PFX password:
CertUtil: -importPFX command FAILED: 0x80092007 (-2146885625 CRYPT_E_SELF_SIGNED)
CertUtil: The specified certificate is self signed.

NOTE: This one has not outout

$ Import-PfxCertificate -FilePath .\mitmproxy-ca-cert.p12 Cert:\LocalMachine\Root

And now if you check certificates from cert manager using:

$ certlm

You won't find any certificates with name/description mitmproxy.

Solution

Download the certificate mitmproxy-ca-cert.cer available for Android from http://mitm.it after setting up the proxy. And run the following command (Requires Admin Privileges for LocalMachine):

$ powershell.exe "Import-Certificate -FilePath .\mitmproxy-ca-cert.cer -CertStoreLocation cert:\LocalMachine\Root"


    Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root


Thumbprint                                Subject
----------                                -------
3167632FC7FAFB43EB6A04662CEE5069D7D319F7  O=mitmproxy, CN=mitmproxy

Verify that the certificate is installed by going to certlm or listing the root certificates:

$ dir cert:\\LocalMachine\Root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment