File tree Expand file tree Collapse file tree
FreeRASPDemoApp/app/src/main/java/com/aheaditec/talsec/demoapp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,26 +37,18 @@ object Utils {
3737 }
3838
3939 private fun getApkSigningCertificate (packageInfo : PackageInfo ): List <String > {
40- val signingHashes = mutableListOf<String >()
41- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
42- packageInfo.signingInfo?.apply {
43- if (hasMultipleSigners()) {
44- apkContentsSigners?.forEach {
45- signingHashes.add(hashCertificate(it))
46- }
40+ return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
41+ packageInfo.signingInfo?.let { signingInfo ->
42+ if (signingInfo.hasMultipleSigners()) {
43+ signingInfo.apkContentsSigners?.map(::hashCertificate).orEmpty()
4744 } else {
48- signingCertificateHistory?.forEach {
49- signingHashes.add(hashCertificate(it))
50- }
45+ signingInfo.signingCertificateHistory?.map(::hashCertificate).orEmpty()
5146 }
52- }
47+ }.orEmpty()
5348 } else {
5449 @Suppress(" DEPRECATION" )
55- packageInfo.signatures?.forEach {
56- signingHashes.add(hashCertificate(it))
57- }
50+ packageInfo.signatures?.map(::hashCertificate).orEmpty()
5851 }
59- return signingHashes
6052 }
6153
6254 private fun hashCertificate (signature : Signature ): String {
You can’t perform that action at this time.
0 commit comments