diff --git a/testapps/AndroidManifest.xml b/testapps/AndroidManifest.xml
index 592145b..83f021f 100644
--- a/testapps/AndroidManifest.xml
+++ b/testapps/AndroidManifest.xml
@@ -25,6 +25,7 @@
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.CALL_PHONE" />
     <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" />
+    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
     <uses-permission android:name="android.permission.READ_CALL_LOG" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
@@ -178,6 +179,16 @@
             </intent-filter>
           </activity>
 
+        <activity android:name="com.android.server.telecom.testapps.TestCertActivity"
+                android:label="@string/KeyUiAppLabel"
+                android:launchMode="singleInstance">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+          </activity>
+
         <activity android:name="com.android.server.telecom.testapps.SelfManagedCallingActivity"
                   android:label="@string/selfManagedCallingActivityLabel"
                   android:process="com.android.server.telecom.testapps.SelfMangingCallingApp"
diff --git a/testapps/res/layout/key_list.xml b/testapps/res/layout/key_list.xml
new file mode 100644
index 0000000..f56836c
--- /dev/null
+++ b/testapps/res/layout/key_list.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="fill_parent"
+      android:layout_height="wrap_content"/>
diff --git a/testapps/res/layout/testcert_main.xml b/testapps/res/layout/testcert_main.xml
new file mode 100644
index 0000000..84ed1e8
--- /dev/null
+++ b/testapps/res/layout/testcert_main.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+    <EditText
+        android:id="@+id/text"
+        android:inputType="text"
+        android:layout_width="200dp"
+        android:layout_height="wrap_content" />
+    <Button
+        android:id="@+id/get_key_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/getKeyButton" />
+     <ListView
+        android:id="@+id/keylist"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content" />
+</LinearLayout>
diff --git a/testapps/res/values/donottranslate_strings.xml b/testapps/res/values/donottranslate_strings.xml
index bfe7550..a0485d0 100644
--- a/testapps/res/values/donottranslate_strings.xml
+++ b/testapps/res/values/donottranslate_strings.xml
@@ -64,6 +64,10 @@
 
     <string name="placeUssdButton">Send USSD</string>
 
+    <string name="KeyUiAppLabel">Get Key UI</string>
+
+    <string name="getKeyButton">Get Key Json</string>
+
     <!-- String for button in SelfManagedCallingActivity. -->
     <string name="checkIfPermittedBeforeCallingButton">Check if calls permitted before calling</string>
 
diff --git a/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java b/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java
new file mode 100644
index 0000000..0df836c
--- /dev/null
+++ b/testapps/src/com/android/server/telecom/testapps/TestCertActivity.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.server.telecom.testapps;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.telephony.ImsiEncryptionInfo;
+import android.text.TextUtils;
+import android.util.Log;
+import android.telephony.TelephonyManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import android.app.ProgressDialog;
+import android.os.AsyncTask;
+import android.util.Log;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.X509EncodedKeySpec;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.ProtocolException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import android.util.Base64;
+
+public class TestCertActivity extends Activity {
+
+    private EditText mCertUrlView;
+    public static final String LOG_TAG = "TestCertActivity";
+
+    private ProgressDialog progressDialog;
+    private ArrayList<String> keyList = new ArrayList<String>();
+
+    // URL to get the json
+    private String mURL = "";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.testcert_main);
+        findViewById(R.id.get_key_button).setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                new GetKeys().execute();
+            }
+        });
+
+        mCertUrlView = (EditText) findViewById(R.id.text);
+        mCertUrlView.setText(mURL);
+    }
+
+    public static PublicKey makeKeyObject(byte[] publicKeyBytes) {
+        try {
+            X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(publicKeyBytes);
+            return KeyFactory.getInstance("RSA").generatePublic(pubKeySpec);
+        } catch (InvalidKeySpecException | NoSuchAlgorithmException ex) {
+            Log.e(LOG_TAG, "Error makeKeyObject: unable to convert into PublicKey", ex);
+        }
+        return null;
+    }
+
+    /**
+     * Class to get json by making HTTP call
+     */
+    private class GetKeys extends AsyncTask<Void, Void, Void> {
+
+        @Override
+        protected void onPreExecute() {
+            super.onPreExecute();
+            progressDialog = new ProgressDialog(TestCertActivity.this);
+            progressDialog.setMessage("Downloading...");
+            progressDialog.setCancelable(false);
+            progressDialog.show();
+        }
+
+        public String getCertificateList() {
+            String response = null;
+            String mURL = mCertUrlView.getText().toString();
+            try {
+                URL url = new URL(mURL);
+                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+                conn.setRequestMethod("GET");
+                // read the response
+                InputStream in = new BufferedInputStream(conn.getInputStream());
+                response = convertToString(in);
+            } catch (ProtocolException e) {
+                Log.e(LOG_TAG, "ProtocolException: " + e.getMessage());
+            } catch (MalformedURLException e) {
+                Log.e(LOG_TAG, "MalformedURLException: " + e.getMessage());
+            } catch (IOException e) {
+                Log.e(LOG_TAG, "IOException: " + e.getMessage());
+            } catch (Exception e) {
+                Log.e(LOG_TAG, "Exception: " + e.getMessage());
+            }
+            return response;
+        }
+
+        private String convertToString(InputStream is) {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+            StringBuilder sb = new StringBuilder();
+
+            String line;
+            try {
+                while ((line = reader.readLine()) != null) {
+                    sb.append(line).append('\n');
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            } finally {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            return sb.toString();
+        }
+
+        private void savePublicKey(String key, int type, String identifier) {
+            byte[] keyBytes = Base64.decode(key.getBytes(), Base64.DEFAULT);
+            PublicKey publicKey = makeKeyObject(keyBytes);
+            Log.i(LOG_TAG, "generated public key: " + publicKey);
+            final TelephonyManager telephonyManager =
+                    (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+
+            String mcc = "";
+            String mnc = "";
+            String networkOperator = telephonyManager.getNetworkOperator();
+
+            if (!TextUtils.isEmpty(networkOperator)) {
+                mcc = networkOperator.substring(0, 3);
+                mnc = networkOperator.substring(3);
+                Log.i(LOG_TAG, "using values for mnc, mcc: " + mnc + "," + mcc);
+            }
+
+            ImsiEncryptionInfo imsiEncryptionInfo = new ImsiEncryptionInfo(mcc,
+                    mnc, type, identifier, publicKey);
+            telephonyManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo);
+            keyList.add(imsiEncryptionInfo.getKeyType() + "," +
+                    imsiEncryptionInfo.getKeyIdentifier());
+            Log.i(LOG_TAG,"calling telephonymanager complete");
+        }
+
+        @Override
+        protected Void doInBackground(Void... arg0) {
+            // Making a request to url and getting response
+            String jsonStr = getCertificateList();
+            Log.d(LOG_TAG, "Response from url: " + jsonStr);
+
+            if (jsonStr != null) {
+                try {
+                    JSONObject jsonObj = new JSONObject(jsonStr);
+                    // Getting JSON Array node
+                    JSONArray certificates = jsonObj.getJSONArray("certificates");
+
+                    // looping through the certificates
+                    for (int i = 0; i < certificates.length(); i++) {
+                        JSONObject cert = certificates.getJSONObject(i);
+                        String key = cert.getString("key");
+                        int type = cert.getInt("type");
+                        String identifier = cert.getString("identifier");
+                        savePublicKey(key, type, identifier);
+                    }
+                } catch (final JSONException e) {
+                    Log.e(LOG_TAG, "Json parsing error: " + e.getMessage());
+                    runOnUiThread(new Runnable() {
+                        @Override
+                        public void run() {
+                            Toast.makeText(getApplicationContext(),
+                                    "Json parsing error: " + e.getMessage(),
+                                    Toast.LENGTH_LONG)
+                                    .show();
+                        }
+                    });
+                }
+            } else {
+                Log.e(LOG_TAG, "Unable to get JSON from server " + mURL);
+                runOnUiThread(new Runnable() {
+                    @Override
+                    public void run() {
+                        Toast.makeText(getApplicationContext(),
+                                "Unable to get JSON from server!",
+                                Toast.LENGTH_LONG)
+                                .show();
+                    }
+                });
+            }
+            return null;
+        }
+
+        @Override
+        protected void onPostExecute(Void result) {
+
+            super.onPostExecute(result);
+            if (progressDialog.isShowing()) {
+                progressDialog.dismiss();
+            }
+            ListView listView = (ListView) findViewById(R.id.keylist);
+            ArrayAdapter arrayAdapter =
+                    new ArrayAdapter(TestCertActivity.this, R.layout.key_list, keyList);
+            listView.setAdapter(arrayAdapter);
+        }
+    }
+}
+
+
