Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
App Lounge
Commits
744b309d
Commit
744b309d
authored
Aug 19, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/build.gradle
View file @
744b309d
...
...
@@ -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"
...
...
app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt
View file @
744b309d
...
...
@@ -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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment