How do I import a CA certificate into Android 4.4.

2019-02-06 10:19发布

问题:

I tried both DER and PEM formats. I tried using the file extensions crt, cer, p12, pem but nothing of them get imported. I went into Settings > Security > Install from SD card and it takes me to the Downloads page. I have the certificates listed but when I click on them, nothing happens.

Updated to add: I ended up going back to 4.3. It works fine in that.

回答1:

  1. Go to Android Virtual Device Manager (sdk\tools\android.bat avd)
  2. Start your emulator but select 'Wipe user Data' when you're starting the emulator
  3. Copy your certificate into /storage/sdcard using e.g. sdk/tools/monitor.bat
  4. Set a screenlock pin here: Settings > Security > Screenlock > PIN
  5. Now you can import the certificate properly via Settings > Security > Install from storage

Background: I also had the same problem you described and it seems to be an android emulator 4.4.2 bug which occurs when you don't import the certificate first thing i.e. when you don't follow the exact steps above.



回答2:

With your limited description, I'll try to help as much as I can.

Ensure your problematic AVD (4.4 I assume) has available storage space. Try best to ensure it is a clean AVD with nothing extra installed.

Place your cert in the root /sdcard/ and install at: Settings -> Security -> Install from SD card

Avoid installation of certs with the same name but different formats.



回答3:

Problem with *.p12 files (pkcs12):

at: Settings -> Security -> Install from SD card the *.p12 files are grayed out. When I download the file via webserver and try to open it, android say me "Can't open" Same with *.pem files. I tried it with 4.4.2 and 4.4.4.



回答4:

There is a script available at https://github.com/mitmproxy/mitmproxy/issues/204#issuecomment-32837093.