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

Commit cafdb4d6 authored by Janis Danisevskis's avatar Janis Danisevskis
Browse files

Keystore 2.0: Use public API to get Keystore for bluetooth.

Test: Device boots without Bluetooth app crashing when running with
      Keystore 2.0
Bug: 159476193
Change-Id: Ib8496cec856d5a742a9a54672fb9e0df1f100fe8
parent 3df1e20f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.bluetooth.btservice.bluetoothkeystore;
import android.annotation.Nullable;
import android.os.Process;
import android.os.SystemProperties;
import android.security.keystore.AndroidKeyStoreProvider;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.util.Log;
@@ -43,6 +42,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.ProviderException;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import java.util.Base64;
import java.util.HashMap;
import java.util.LinkedList;
@@ -786,11 +786,11 @@ public class BluetoothKeystoreService {

        while ((counter <= TRY_MAX) && (keyStore == null)) {
            try {
                keyStore = AndroidKeyStoreProvider.getKeyStoreForUid(Process.BLUETOOTH_UID);
            } catch (NoSuchProviderException e) {
                reportKeystoreException(e, "cannot find crypto provider");
            } catch (KeyStoreException e) {
                reportKeystoreException(e, "cannot find the keystore");
                keyStore = KeyStore.getInstance("AndroidKeyStore");
                keyStore.load(null);
            } catch (KeyStoreException | CertificateException | NoSuchAlgorithmException
                    | IOException e) {
                reportKeystoreException(e, "cannot open keystore");
            }
            counter++;
        }