Add logging to LocalKeyStore.isValidCertificate()
This commit is contained in:
parent
ddd4d9099a
commit
be4a078a4b
1 changed files with 17 additions and 1 deletions
|
@ -112,8 +112,24 @@ class LocalKeyStore(private val directoryProvider: KeyStoreDirectoryProvider) {
|
|||
|
||||
return try {
|
||||
val storedCert = keyStore.getCertificate(getCertKey(host, port))
|
||||
storedCert == certificate
|
||||
if (storedCert == null) {
|
||||
Timber.v("Couldn't find a stored certificate for %s:%d", host, port)
|
||||
false
|
||||
} else if (storedCert != certificate) {
|
||||
Timber.v(
|
||||
"Stored certificate for %s:%d doesn't match.\nExpected:\n%s\nActual:\n%s",
|
||||
host,
|
||||
port,
|
||||
storedCert,
|
||||
certificate
|
||||
)
|
||||
false
|
||||
} else {
|
||||
Timber.v("Stored certificate for %s:%d matches the server certificate", host, port)
|
||||
true
|
||||
}
|
||||
} catch (e: KeyStoreException) {
|
||||
Timber.w(e, "Error reading from KeyStore")
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue