mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-18 13:00:18 +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>) {
|
private fun checkTrusted(chain: Array<X509Certificate>) {
|
||||||
val cert = chain[0]
|
val cert = chain[0]
|
||||||
|
|
||||||
var found = false
|
if (!fingerprints.any { it.matchesCert(cert) }) {
|
||||||
|
|
||||||
for (allowedFingerprint in fingerprints) {
|
|
||||||
if (allowedFingerprint.matchesCert(cert)) {
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
throw UnrecognizedCertificateException(cert, Fingerprint.newSha256Fingerprint(cert), null)
|
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>) {
|
private fun checkTrusted(chain: Array<X509Certificate>) {
|
||||||
val cert = chain[0]
|
val cert = chain[0]
|
||||||
|
|
||||||
var found = false
|
if (!fingerprints.any { it.matchesCert(cert) }) {
|
||||||
for (allowedFingerprint in fingerprints) {
|
|
||||||
if (allowedFingerprint.matchesCert(cert)) {
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
throw UnrecognizedCertificateException(cert, Fingerprint.newSha256Fingerprint(cert), null)
|
throw UnrecognizedCertificateException(cert, Fingerprint.newSha256Fingerprint(cert), null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue