certificate import in android 4.4.2 emulator
See original GitHub issueHi,
I was trying to import the mitmproxy certificate into an emulated android 4.4.2 device. But no matter where I put the certificate (tried /scard/Download
, /sdcard
, /mnt/sdcard
, /mnt/sdcard/Download
, /storage/sdcard/Download
, /storage/sdcard
), the certificate import did not show the certificate (but it did show apk files in /sdcard/Download
).
This means that the instructions given at http://mitmproxy.org/doc/certinstall/android.html are either outdated for android 4.4.2, that this is a problem only appearing in the emulator or that I do something horribly wrong.
Nevertheless, I managed to import the certificate in the end by doing:
fname=`openssl x509 -inform PEM -subject_hash_old -noout -in ~/.mitmproxy/mitmproxy-ca-cert.cer`.0
cp ~/.mitmproxy/mitmproxy-ca-cert.cer $fname
openssl x509 -inform PEM -text -noout -in ~/.mitmproxy/mitmproxy-ca-cert.cer >> $fname
adb push $fname /system/etc/security/cacerts/
adb shell chmod 644 /system/etc/security/cacerts/$fname
Maybe it would make sense to verify whether I just messed up somewhere or whether the instructions at http://mitmproxy.org/doc/certinstall/android.html indeed need updating and if they do, to also provide this new certificate format.
Issue Analytics
- State:
- Created 10 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Hey josh, I had exactly the same problem that you described before, is something related with the emulator, apparently it doesn’t detect the external storage where you uploaded the certificate.
There is a workaround that may work for you, and will install the certificate as system and not as user. If you go to the following folder:
You can see there, all the certificates installed onto your device or emulator. It’s content is something like this http://pastebin.com/DzJFbXdz
I did this script that will prepare the certificate that you may want to install with the same appearance:
Run it as follows:
It should work, and you should be able to see the new certificate listed in ‘Settings > Security > Trusted Cert > Systems’.
Anyway, I switched from 4.4.2 to 4.2.2, so maybe that will work for you too.
In 7.0 emulator, use
mount -o rw,remount /dev/block/vda /system
to remount fs.