mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Kotlin style
This commit is contained in:
parent
b8b79de91c
commit
057f6fdf26
2 changed files with 2 additions and 19 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue