[Sony Cross-Device Development Themes and Apps] venkat kamesh:
Hello guys

i just found a simple way to disable Signature verification on Nougat / Marshmallow

Tested on Sony and LG .. should also work on AOSP, and based roms

Firstly thanks to My best buddy/ brother (moon guy) [MENTION=5178785]kingdj[/MENTION] haha

Requirements:-

- Deodexed Rom

- Services.jar

- core-oj.jar

- Latest Apktools ( i suggest Tickle my android tool by [MENTION=4315551]Ticklefish[/MENTION] )

Lets start Start

1. Decompile services.jar (Nougat/MM versions)

2. Open services.jar\smali\com\android\server\pm\PackageManagerService.smali

Method 1 :- (not working for few devices)

look for this method

method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

in that method find these line

:goto_0
return v3

:cond_0
const/4 v3, -0x1

goto :goto_0

and replace them with this

:goto_0
const/4 v3, 0x0

:cond_0
const/4 v3, 0x0

return v3

Now look for this code

invoke-static {v0, v6}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

[COLOR="red"]move-result v6[/COLOR]

if-eqz v6, :cond_7

Add these changes to that code ( Just red code give an edit )

invoke-static {v0, v6}, Lcom/android/server/pm/PackageManagerService;->compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

[COLOR="red"]const/4 v6, 0x0[/COLOR]

if-eqz v6, :cond_7

Here its Done...!

save and Close :p

Method 2 :- (will work on any device / easy)

look for this method

method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I

Replace the complete method with this

.method static compareSignatures([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)I
.locals 13

const/4 v0, 0x0

return v0
.end method

and find his method

.method private compareSignaturesCompat(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I

replace the complete method with this

.method private compareSignaturesCompat(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I

.locals 13

const/4 v0, 0x0

return v0
.end method

and find his method

.method private compareSignaturesRecover(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I

replace the complete method with this

.method private compareSignaturesRecover(Lcom/android/server/pm/PackageSignatures;Landroid/content/pm/PackageParser$Package;)I

.locals 13

const/4 v0, 0x0

return v0
.end method

3. Decompile core-oj.jar ( Red line should be replaced and blue should be matched

open core-oj/smali/java/security/Signature.smali

find this method

.method public final verify([B)Z

in that method find this lines

invoke-virtual {p0, p1}, Ljava/security/Signature;->engineVerify([B)Z

[COLOR="Red"]move-result v[COLOR="blue"]0[/COLOR][/COLOR]

Change Red line to this

[COLOR="red"]const/4 v[COLOR="blue"]0[/COLOR], 0x1[/COLOR]

.method public final verify([BII)Z

in that method find this lines

invoke-virtual {p0, p1, p2, p3}, Ljava/security/Signature;->engineVerify([BII)Z

[COLOR="Red"]move-result v[COLOR="blue"]0[/COLOR][/COLOR]

Change Red line to this

[COLOR="red"]const/4 v[COLOR="blue"]0[/COLOR], 0x1[/COLOR]

save and close

Now open core-oj/smali/java/security/MessageDigest.smali

Find this method and lines

.method public static isEqual([B[B)Z
.registers 7
.param p0, "digesta" # [B
.param p1, "digestb" # [B

.prologue
[COLOR="red"]const/4 v[COLOR="blue"]2[/COLOR], 0x0[/COLOR]

array-length v3, p0

array-length v4, p1

if-eq v3, v4, :cond_6

In that change red line to this

const/4 v[COLOR="Blue"]2[/COLOR], 0x1

Now For Sony devices There is other thing to disable signature Verification...! ( if persists else ignore )

open services.jar/smali/com/android/server/AppOpsService.smali

in that look for this lines

invoke-direct {p0, p4, p3}, Lcom/android/server/AppOpsService;->isSystemOrPrivApp(Ljava/lang/String;I)Z

move-result v2

if-eqz v2, :cond_1

Delete all those 3 lines and save .... tada

So now super user mode is ready .. you can now do more

Dont forget to mention me if you used my tuts and if i helped you ,....

Regards

VK