fixup! HttpClient: Enable SSL pinning for google domains
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -40,6 +40,9 @@ object CertUtil {
|
|||||||
|
|
||||||
private val TAG = "CertUtil"
|
private val TAG = "CertUtil"
|
||||||
|
|
||||||
|
private const val CERT_BEGIN = "-----BEGIN CERTIFICATE-----"
|
||||||
|
private const val CERT_END = "-----END CERTIFICATE-----"
|
||||||
|
|
||||||
fun isAuroraStoreApp(context: Context, packageName: String): Boolean {
|
fun isAuroraStoreApp(context: Context, packageName: String): Boolean {
|
||||||
return context.packageManager.getInstallerPackageNameCompat(packageName) == context.packageName
|
return context.packageManager.getInstallerPackageNameCompat(packageName) == context.packageName
|
||||||
}
|
}
|
||||||
@@ -112,12 +115,8 @@ object CertUtil {
|
|||||||
val rawCerts = inputStream
|
val rawCerts = inputStream
|
||||||
.bufferedReader()
|
.bufferedReader()
|
||||||
.use { it.readText() }
|
.use { it.readText() }
|
||||||
.split("-----END CERTIFICATE-----")
|
.split(CERT_END)
|
||||||
.map {
|
.map { it.substringAfter(CERT_BEGIN).substringBefore(CERT_END).replace("\n", "") }
|
||||||
it.substringAfter("-----BEGIN CERTIFICATE-----")
|
|
||||||
.substringBefore("-----END CERTIFICATE-----")
|
|
||||||
.replace("\n", "")
|
|
||||||
}
|
|
||||||
.filterNot { it.isBlank() }
|
.filterNot { it.isBlank() }
|
||||||
val decodedCerts = rawCerts.map { Base64.decode(it, Base64.DEFAULT) }
|
val decodedCerts = rawCerts.map { Base64.decode(it, Base64.DEFAULT) }
|
||||||
return decodedCerts.map {
|
return decodedCerts.map {
|
||||||
|
|||||||
Reference in New Issue
Block a user