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

Commit fcaf9c30 authored by Pankaj Kanwar's avatar Pankaj Kanwar Committed by Android (Google) Code Review
Browse files

Merge "Changes to align with improvements to ImsiEncryptionInfo."

parents ed317f45 4e04c6c8
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());