mirror of
https://github.com/home-assistant/android
synced 2024-09-30 05:14:12 +00:00
Catch AssertionError when loading certificates/private key (mTLS) (#4456)
This commit is contained in:
parent
d516018dc4
commit
4e9c958232
|
@ -63,16 +63,24 @@ class KeyChainRepositoryImpl @Inject constructor(
|
|||
if (chain == null) {
|
||||
chain = try {
|
||||
KeyChain.getCertificateChain(context, alias!!)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Exception getting certificate chain", e)
|
||||
} catch (t: Throwable) {
|
||||
when (t) {
|
||||
is AssertionError,
|
||||
is Exception -> Log.e(TAG, "Issue getting certificate chain", t)
|
||||
else -> throw t
|
||||
}
|
||||
null
|
||||
}
|
||||
}
|
||||
if (key == null) {
|
||||
key = try {
|
||||
KeyChain.getPrivateKey(context, alias!!)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Exception getting private key", e)
|
||||
} catch (t: Throwable) {
|
||||
when (t) {
|
||||
is AssertionError,
|
||||
is Exception -> Log.e(TAG, "Issue getting private key", t)
|
||||
else -> throw t
|
||||
}
|
||||
null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue