From 53622fc40b88047a1bc1f2dd6c97a5ad8e8c8f66 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 28 Mar 2013 11:08:18 -0700 Subject: Add ability to install credentials as other UID We need the ability to install from the system UID to wifi UID to explicitly bind WiFi credentials to the WiFi profile. This adds the ability for Wifi Settings to invoke installation of a PKCS12 file for the wifi UID. Bug: 8183258 Change-Id: I26970e563d68311b60dcdc78cd529322c5807368 --- AndroidManifest.xml | 12 ++++++++++++ src/com/android/certinstaller/CertFile.java | 19 ++++++++++++++----- src/com/android/certinstaller/CertFileList.java | 1 + src/com/android/certinstaller/CertInstallerMain.java | 18 ++++++++++++++++-- src/com/android/certinstaller/CredentialHelper.java | 5 +++++ 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 031cc72..b2880d6 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -5,6 +5,9 @@ + + + + + + + + + mBundle = new HashMap(); private String mName = ""; + private int mUid = -1; private PrivateKey mUserKey; private X509Certificate mUserCert; private List mCaCerts = new ArrayList(); @@ -83,6 +84,9 @@ class CredentialHelper { mName = name; } + mUid = bundle.getInt(Credentials.EXTRA_INSTALL_AS_UID, -1); + bundle.remove(Credentials.EXTRA_INSTALL_AS_UID); + Log.d(TAG, "# extras: " + bundle.size()); for (String key : bundle.keySet()) { byte[] bytes = bundle.getByteArray(key); @@ -249,6 +253,7 @@ class CredentialHelper { // To prevent the private key from being sniffed, we explicitly spell // out the intent receiver class. intent.setClassName("com.android.settings", "com.android.settings.CredentialStorage"); + intent.putExtra(Credentials.EXTRA_INSTALL_AS_UID, mUid); try { if (mUserKey != null) { intent.putExtra(Credentials.EXTRA_USER_PRIVATE_KEY_NAME, -- cgit v1.2.3