Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sleeyax/1a55e8ae35ca65b11d15519c258a13aa to your computer and use it in GitHub Desktop.
Save sleeyax/1a55e8ae35ca65b11d15519c258a13aa to your computer and use it in GitHub Desktop.
Packet Capture Android app how to import custom certificate

Step by step guide on how to generate and import a custom certificate into the Packet Capture Android app. Useful when the "generate certificate" feature doens't work for you either.

  1. Generate certificate using openssl on your (linux) computer. You can also do this right on your Android device with a terminal/Termux/openssl app.
    • openssl req -x509 -newkey rsa:4096 -keyout key-private.pem -out key-public.pem -days 3650
  2. Export certificate to PKCS12 format
    • openssl pkcs12 -export -out keyBundle.p12 -inkey key-private.pem -in key-public.pem -name alias -legacy
    • Choose any password and alias name, make sure you remember it for the next few steps.
  3. Transfer keyBundle.p12 and key-public.pem to the android device
    • e.g. adb push keyBundle.p12 /sdcard/Download etc.
  4. In android settings, go to Biometrics and Security (note I have a Samsung device, it might be different for you) > Other Security Settings > Credential Storage > Install from device storage > CA Certificate > Accept the scary red warning and tap "Install anyway" > enter your pincode > find key-public.pem and click "Done"
  5. Going back to "Install from device storage," > VPN and app user certificate > find keyBundle.p12 > Enter password and alias
  6. Open packet capture > Setting > Tap "No CA certificate" > Import PKCS#12 file > find keyBundle.p12. Enter password and alias. Restart packet capture. If everything worked, the "Status" subtitle should say "Installed to trusted credentials"
  7. Restart your device
    • adb shell reboot

Done! SSL sniffing should work for most apps now but it can be hit or miss unfortunately.

Credits

This guide is based on this stackexchange post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment