简体   繁体   English

如何在模拟器中将 CA 证书导入 Android 4.4.2?

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

I tried both DER and PEM formats.我尝试了 DER 和 PEM 格式。 I tried using the file extensions crt, cer, p12, pem but nothing of them get imported.我尝试使用文件扩展名 crt、cer、p12、pem,但没有导入。 I went into Settings > Security > Install from SD card and it takes me to the Downloads page.我进入“设置”>“安全”>“从 SD 卡安装”,它会将我带到“下载”页面。 I have the certificates listed but when I click on them, nothing happens.我列出了证书,但是当我点击它们时,没有任何反应。

Updated to add: I ended up going back to 4.3.更新添加:我最终回到了 4.3。 It works fine in that.它在这方面工作得很好。

  1. Go to Android Virtual Device Manager (sdk\\tools\\android.bat avd)转到 Android 虚拟设备管理器 (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 eg sdk/tools/monitor.bat使用例如 sdk/tools/monitor.bat 将您的证书复制到 /storage/sdcard
  4. Set a screenlock pin here: Settings > Security > Screenlock > PIN在此处设置屏幕锁定引脚:设置 > 安全 > 屏幕锁定 > 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 ie when you don't follow the exact steps above.背景:我也遇到了您描述的相同问题,这似乎是一个 android 模拟器 4.4.2 错误,当您不首先导入证书时,即当您不遵循上述确切步骤时,就会发生该错误。

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.我从我的电脑上将证书通过电子邮件发送给自己,打开模拟器,运行 gmail 并通过 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选择选定的 CA 证书
  6. Install anyway仍然安装
  7. tap on the downloaded certificate点击下载的证书

You should get a Toast saying that the CA certificate was installed.你应该得到一个 Toast,说 CA 证书已安装。

This is for an emulator running Android R .这是针对运行Android R的模拟器。 Good luck!祝你好运!

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.确保有问题的 AVD(我假设为 4.4)有可用的存储空间。 Try best to ensure it is a clean AVD with nothing extra installed.尽量确保它是一个干净的 AVD,没有安装任何额外的东西。

Place your cert in the root /sdcard/ and install at: Settings -> Security -> Install from SD card将您的证书放在根目录 /sdcard/ 并安装在:设置 -> 安全 -> 从 SD 卡安装

Avoid installation of certs with the same name but different formats.避免安装名称相同但格式不同的证书。

Problem with *.p12 files (pkcs12): *.p12 文件 (pkcs12) 的问题:

at: Settings -> Security -> Install from SD card the *.p12 files are grayed out.在:设置 -> 安全 -> 从 SD 卡安装 *.p12 文件是灰色的。 When I download the file via webserver and try to open it, android say me "Can't open" Same with *.pem files.当我通过网络服务器下载文件并尝试打开它时,android 说我“无法打开”与 *.pem 文件相同。 I tried it with 4.4.2 and 4.4.4.我用 4.4.2 和 4.4.4 试过了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在android模拟器上安装CA证书 - Install CA Certificate on android emulator android:如何接受CA证书 - android: how to accept CA certificate 如何在Android手机中使用私钥导入自签名certificate.ca? - How to import self-signed certificate.ca with private keys in android phone? 如何在 Android 设备上安装可信 CA 证书? - How to install trusted CA certificate on Android device? 模拟器中缺少 Google Play 服务 (Android 4.4.2) - Google Play Services Missing in Emulator (Android 4.4.2) Android 4.4.2(Samsung s4 mini)-如何重置凭证存储密码 - Android 4.4.2 (Samsung s4 mini) - How do I reset the credential storage password 如何使用未知 CA 自签名的证书让 Android Volley 执行 HTTPS 请求? - How can I make Android Volley perform HTTPS request, using a certificate self-signed by an Unknown CA? 如何为“Visual Studio emulator for android”的模拟器安装证书? - How can I install certificate for “Visual studio emulator for android”'s emulator? 如何在 Android Studio 中激活模拟器? - How do I activate the emulator in Android Studio? 如何优化 Android Studio 模拟器 - How do I optimize The Android Studio emulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM