Search in sources :

Example 11 with ImsiEncryptionInfo

use of android.telephony.ImsiEncryptionInfo in project android_frameworks_opt_telephony by LineageOS.

the class CarrierKeyDownloadManager method savePublicKey.

/**
 * Save the public key
 * @param publicKey public key.
 * @param type key-type.
 * @param identifier which is an opaque string.
 * @param expirationDate expiration date of the key.
 * @param mcc
 * @param mnc
 */
@VisibleForTesting
public void savePublicKey(PublicKey publicKey, int type, String identifier, long expirationDate, String mcc, String mnc) {
    ImsiEncryptionInfo imsiEncryptionInfo = new ImsiEncryptionInfo(mcc, mnc, type, identifier, publicKey, new Date(expirationDate));
    mPhone.setCarrierInfoForImsiEncryption(imsiEncryptionInfo);
}
Also used : ImsiEncryptionInfo(android.telephony.ImsiEncryptionInfo) Date(java.util.Date) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Example 12 with ImsiEncryptionInfo

use of android.telephony.ImsiEncryptionInfo in project android_frameworks_opt_telephony by LineageOS.

the class RIL method setCarrierInfoForImsiEncryption.

@Override
public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo, Message result) {
    checkNotNull(imsiEncryptionInfo, "ImsiEncryptionInfo cannot be null.");
    IRadio radioProxy = getRadioProxy(result);
    if (radioProxy != null) {
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
            android.hardware.radio.V1_1.IRadio radioProxy11 = (android.hardware.radio.V1_1.IRadio) radioProxy;
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result, mRILDefaultWorkSource);
            if (RILJ_LOGD)
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            try {
                android.hardware.radio.V1_1.ImsiEncryptionInfo halImsiInfo = new android.hardware.radio.V1_1.ImsiEncryptionInfo();
                halImsiInfo.mnc = imsiEncryptionInfo.getMnc();
                halImsiInfo.mcc = imsiEncryptionInfo.getMcc();
                halImsiInfo.keyIdentifier = imsiEncryptionInfo.getKeyIdentifier();
                if (imsiEncryptionInfo.getExpirationTime() != null) {
                    halImsiInfo.expirationTime = imsiEncryptionInfo.getExpirationTime().getTime();
                }
                for (byte b : imsiEncryptionInfo.getPublicKey().getEncoded()) {
                    halImsiInfo.carrierKey.add(new Byte(b));
                }
                radioProxy11.setCarrierInfoForImsiEncryption(rr.mSerial, halImsiInfo);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setCarrierInfoForImsiEncryption", e);
            }
        } else if (result != null) {
            AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }
}
Also used : ImsiEncryptionInfo(android.telephony.ImsiEncryptionInfo) IRadio(android.hardware.radio.V1_0.IRadio) RemoteException(android.os.RemoteException)

Example 13 with ImsiEncryptionInfo

use of android.telephony.ImsiEncryptionInfo in project android_frameworks_opt_telephony by LineageOS.

the class ImsiEncryptionInfoTest method setUp.

@Before
public void setUp() throws Exception {
    mPublicKey = createPublicKey(TEST_CERT);
    mImsiEncryptionInfo = new ImsiEncryptionInfo("310", "270", TelephonyManager.KEY_TYPE_WLAN, "key1=value", mPublicKey, mDate);
}
Also used : ImsiEncryptionInfo(android.telephony.ImsiEncryptionInfo) Before(org.junit.Before)

Aggregations

ImsiEncryptionInfo (android.telephony.ImsiEncryptionInfo)13 Date (java.util.Date)9 SmallTest (android.test.suitebuilder.annotation.SmallTest)6 Test (org.junit.Test)6 PublicKey (java.security.PublicKey)5 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)3 ContentResolver (android.content.ContentResolver)2 Cursor (android.database.Cursor)2 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 IRadio (android.hardware.radio.V1_0.IRadio)1 Parcel (android.os.Parcel)1 RemoteException (android.os.RemoteException)1 TelephonyManager (android.telephony.TelephonyManager)1 Random (java.util.Random)1 Before (org.junit.Before)1