Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import a CA certificate into Android 4.4.2 in the emulator?

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.

like image 232
Crypto Avatar asked Jan 18 '14 16:01

Crypto


People also ask

Where are CA certificates stored in Android?

Now we have to place our CA certificate inside the system certificate store located at /system/etc/security/cacerts/ in the Android filesystem. By default, the /system partition is mounted as read-only.


2 Answers

  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.

like image 52
user2846469 Avatar answered Sep 28 '22 12:09

user2846469


This question is old, but still persists. Hopefully this will help some other developers who still need to add a certificate to their emulator.

Download the certificate using any of the various methods. I emailed myself the certificate from my computer, turned on the emulator, ran gmail and downloaded the certificate to the emulator through gmail.

Depending on your settings, you may be prompted to accept the certificate as soon as its downloaded. Others may be able to find the certificate file using a files program where simply executing it will install the certificate.

But for those who can't, here's the sure-fire method.

  1. Run the Settings app
  2. Security
  3. Encryption & Credentials
  4. Install a Certificate
  5. choose Selected CA Certificate
  6. Install anyway
  7. tap on the downloaded certificate

You should get a Toast saying that the CA certificate was installed.

This is for an emulator running Android R. Good luck!

like image 29
SMBiggs Avatar answered Sep 28 '22 12:09

SMBiggs