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
b86faa91
Commit
b86faa91
authored
Mar 16, 2021
by
narinder Rana
Browse files
handle exception
parent
8aaf1052
Pipeline
#106187
passed with stage
in 4 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/foundation/e/apps/application/model/IntegrityVerificationTask.kt
View file @
b86faa91
...
...
@@ -91,41 +91,46 @@ class IntegrityVerificationTask(
apkInputStream
:
BufferedInputStream
,
apkSignatureInputStream
:
InputStream
,
publicKeyInputStream
:
InputStream
):
Boolean
{
try
{
var
jcaPGPObjectFactory
=
JcaPGPObjectFactory
(
PGPUtil
.
getDecoderStream
(
apkSignatureInputStream
))
val
pgpSignatureList
:
PGPSignatureList
var
jcaPGPObjectFactory
=
JcaPGPObjectFactory
(
PGPUtil
.
getDecoderStream
(
apkSignatureInputStream
))
val
pgpSignatureList
:
PGPSignatureList
val
pgpObject
=
jcaPGPObjectFactory
.
nextObject
()
if
(
pgpObject
is
PGPCompressedData
)
{
jcaPGPObjectFactory
=
JcaPGPObjectFactory
(
pgpObject
.
dataStream
)
pgpSignatureList
=
jcaPGPObjectFactory
.
nextObject
()
as
PGPSignatureList
}
else
{
pgpSignatureList
=
pgpObject
as
PGPSignatureList
}
val
pgpObject
=
jcaPGPObjectFactory
.
nextObject
()
if
(
pgpObject
is
PGPCompressedData
)
{
jcaPGPObjectFactory
=
JcaPGPObjectFactory
(
pgpObject
.
dataStream
)
pgpSignatureList
=
jcaPGPObjectFactory
.
nextObject
()
as
PGPSignatureList
}
else
{
pgpSignatureList
=
pgpObject
as
PGPSignatureList
}
val
pgpPublicKeyRingCollection
=
PGPPublicKeyRingCollection
(
PGPUtil
.
getDecoderStream
(
publicKeyInputStream
),
JcaKeyFingerprintCalculator
())
val
pgpPublicKeyRingCollection
=
PGPPublicKeyRingCollection
(
PGPUtil
.
getDecoderStream
(
publicKeyInputStream
),
JcaKeyFingerprintCalculator
())
val
signature
=
pgpSignatureList
.
get
(
0
)
val
key
=
pgpPublicKeyRingCollection
.
getPublicKey
(
signature
.
keyID
)
val
signature
=
pgpSignatureList
.
get
(
0
)
val
key
=
pgpPublicKeyRingCollection
.
getPublicKey
(
signature
.
keyID
)
signature
.
init
(
BcPGPContentVerifierBuilderProvider
(),
key
)
signature
.
init
(
BcPGPContentVerifierBuilderProvider
(),
key
)
val
buff
=
ByteArray
(
1024
)
var
read
=
apkInputStream
.
read
(
buff
)
while
(
read
!=
-
1
)
{
signature
.
update
(
buff
,
0
,
read
)
read
=
apkInputStream
.
read
(
buff
)
}
val
buff
=
ByteArray
(
1024
)
var
read
=
apkInputStream
.
read
(
buff
)
while
(
read
!=
-
1
)
{
signature
.
update
(
buff
,
0
,
read
)
read
=
apkInputStream
.
read
(
buff
)
}
apkInputStream
.
close
()
apkSignatureInputStream
.
close
()
publicKeyInputStream
.
close
()
apkInputStream
.
close
()
apkSignatureInputStream
.
close
()
publicKeyInputStream
.
close
()
return
signature
.
verify
()
return
signature
.
verify
()
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
false
;
}
}
...
...
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