Commit 744b309d authored by Dayona Joseph's avatar Dayona Joseph
Browse files

Remove apache library and manually convert ByteArray to Hex

parent f8d6b2ea
Pipeline #68658 passed with stage
in 3 minutes and 10 seconds
......@@ -49,8 +49,6 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
testImplementation 'junit:junit:4.12'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.11'
implementation 'org.bouncycastle:bcprov-jdk15on:1.60'
implementation 'org.bouncycastle:bcpg-jdk15on:1.60'
implementation "androidx.vectordrawable:vectordrawable:1.0.0"
......
......@@ -20,7 +20,6 @@ package foundation.e.apps.application.model
import android.content.Context
import android.os.AsyncTask
import foundation.e.apps.application.model.data.FullData
import org.apache.commons.codec.binary.Hex
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.bouncycastle.openpgp.PGPCompressedData
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection
......@@ -65,7 +64,7 @@ class IntegrityVerificationTask(
integrityVerificationCallback.onIntegrityVerified(context, verificationSuccessful)
}
private fun getApkFileSha1(file: File): String {
private fun getApkFileSha1(file: File): String?{
val messageDigest = MessageDigest.getInstance("SHA-1")
val fileInputStream = FileInputStream(file)
var length = 0
......@@ -76,7 +75,12 @@ class IntegrityVerificationTask(
messageDigest.update(buffer, 0, length)
}
}
return String(Hex.encodeHex(messageDigest.digest()))
return byteArrayToHex(messageDigest.digest())
}
private fun byteArrayToHex(a: ByteArray): String? {
val sb = StringBuilder(a.size * 2)
for (b in a) sb.append(String.format("%02x", b))
return sb.toString()
}
private fun verifyAPKSignature(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment