HTTPS certificate configuration
Developers and crawler engineers who have done Android HTTPS packet capture must understand: Android 7.0 is a watershed. Before this, HTTPS traffic could be easily captured by manually installing a user CA certificate; but starting from 7.0, most applications no longer trust user-installed certificates by default, and packet capture tools can only see a full screen of connection resets and error reports.
This article is a "full-process nanny-level tutorial" prepared for you. We will start from scratch, use OpenSSL to generate a self-signed CA certificate, convert it into the special naming format required by the Android system, and then push it to/system/etc/security/cacerts/Directory (requires ROOT permissions). Finally, a one-click Python script will be provided to automate the entire process and truly free your hands.
Install the certificate to the system partition (ROOT version, the most stable)
Android divides certificates into two categories:
- User Certificate: You can install it manually, but Android 7.0+ applications are not trusted by default.
- System Certificate: located in
/system/etc/security/cacerts/, Unconditional Trust for all applications - this is what we want to achieve.
Preparation before operation:
- The device has obtained ROOT permissions.
- The computer has OpenSSL installed and correctly added to the PATH environment variable.
- The device has USB debugging turned on and it works
adbConnect normally.
1. Generate a self-signed CA certificate on your computer
First create our own "trust root certificate" and private key locally:
2. Convert to the naming format required by Android system CA
The naming convention for Android system certificates is very "geek": You must use the legacy MD5 hash of the certificate subject, plus a suffix.0。
Using OpenSSL, you can get this hash value and complete the rename with one click:
3. Push to the system partition and take effect
Next, put the certificate into the read-only system partition with adb and ROOT permissions:
4. Verify installation results
After the device restarts, open a terminal and do a quick check:
If you can see what you just pushed.0file, it means that the system certificate installation has been successful!
Python one-click certificate management script
In order to avoid having to type a long list of commands manually every time, I encapsulated a lightweight Python script. It integrates the entire process of certificate generation, format conversion, push installation and verification, and comes with friendly error prompts.
Complete script
How to use the script
- Make sure your computer has OpenSSL and adb installed, your phone is ROOT, and USB debugging is turned on.
- Save the above script as
cert_manager.py。 - Run in terminal:
- After the script is executed, manually restart the device.
Don’t forget the subsequent configuration
Installing the certificate to the system partition is only the first step. We also need to let the proxy tool use our self-built CA:
- In the proxy tool (Fiddler / Charles / mitmproxy), ** load the just generated
ca.keyandca.crt** to make it trust our own CA. - Set up a Wi‑Fi proxy on your phone, pointing to your computer’s IP and the port the proxy tool listens on.
- Done! Now you can crawl HTTPS traffic normally.
Tip: If the proxy tool does not support direct loading of custom CAs, you can also
ca.crtImported into the system trust store for use.

