Kotlin style

This commit is contained in:
Benoit Marty 2020-07-01 12:11:45 +02:00
parent b8b79de91c
commit 057f6fdf26
2 changed files with 2 additions and 19 deletions

View File

@ -72,16 +72,7 @@ internal class PinnedTrustManager(private val fingerprints: List<Fingerprint>,
private fun checkTrusted(chain: Array<X509Certificate>) {
val cert = chain[0]
var found = false
for (allowedFingerprint in fingerprints) {
if (allowedFingerprint.matchesCert(cert)) {
found = true
break
}
}
if (!found) {
if (!fingerprints.any { it.matchesCert(cert) }) {
throw UnrecognizedCertificateException(cert, Fingerprint.newSha256Fingerprint(cert), null)
}
}

View File

@ -144,15 +144,7 @@ internal class PinnedTrustManagerApi24(private val fingerprints: List<Fingerprin
private fun checkTrusted(chain: Array<X509Certificate>) {
val cert = chain[0]
var found = false
for (allowedFingerprint in fingerprints) {
if (allowedFingerprint.matchesCert(cert)) {
found = true
break
}
}
if (!found) {
if (!fingerprints.any { it.matchesCert(cert) }) {
throw UnrecognizedCertificateException(cert, Fingerprint.newSha256Fingerprint(cert), null)
}
}