Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 026c242e authored by pkanwar's avatar pkanwar
Browse files

resolve merge conflicts of e8ac034b to oc-dr1-dev-plus-aosp

BUG: 35606429
Test: manual
Change-Id: Ie3e285ea93cfb96f9dfbd2f9f8cb2dd63a81a396
parents 559503e8 e8ac034b
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;

import android.util.Base64;

@@ -83,16 +84,6 @@ public class TestCertActivity extends Activity {
        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
     */
@@ -152,8 +143,6 @@ public class TestCertActivity extends Activity {

        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);

@@ -168,7 +157,7 @@ public class TestCertActivity extends Activity {
            }

            ImsiEncryptionInfo imsiEncryptionInfo = new ImsiEncryptionInfo(mcc,
                    mnc, type, identifier, publicKey);
                    mnc, type, identifier, keyBytes, new Date());
            telephonyManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo);
            keyList.add(imsiEncryptionInfo.getKeyType() + "," +
                    imsiEncryptionInfo.getKeyIdentifier());