[Security Discussion] papudrun:
I'm trying to patch apk mentioned in title. Unpacking and packing back with apktool works well and application can be successfully installed on device and I can browse all applications in store but not all functionality is working. When I try to open My Applications or try to install any new application from store then it briefly blink like trying to switch activity window and nothing else happens. Of course my first assumption was some additional security mechanism is in place so quick look in logcat... and here it is (timestamps removed for clarity):

I SEMS:SamsungAccount: ================ checkSignatureValidation ================================================
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : false
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : widgetapp.samsungapps./64/3cf08
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : sa_apps/64/c67d7
I SEMS:SamsungAccount: [AccountResponse] hash value or app id of this apk is not registered. plz register!!!!!!!
I SEMS:SamsungAccount: [AccountResponse] wrong hashcode : sa_apps/64/06bb6
I SEMS:SamsungAccount: [AccountResponse] checkSignatureValidation - false, sa_apps
I SEMS:SamsungAccount: [SignatureCheckUtil] Not matched cache data of signature
I SEMS:SamsungAccount: [SignatureCheckUtil] start request signatureList
I SEMS:SamsungAccount: [SignatureCheckUtil] Server app list : last server request time is not expired.
I SEMS:SamsungAccount: [SignatureCheckUtil] Server app list : last server request time : 20200215174048
I SEMS:SamsungAccount: [RATA] setFailedResult()
I SEMS:SamsungAccount: [RequestAccessTokenActivity] setResultWithLog resultCode=[1]
I SEMS:SamsungAccount: [RequestAccessTokenActivity] errorCode=[SAC_0205], errorMsg[The signature of this application is not registered with the server.]

From this tiny part of log i can assume that:

Some process is calculating SHA256 signature of file

It is compared with some table of allowed hashes/signatures

This table is cached and is valid for some time

But except that I'm little bit dry about ideas where this table is cached and how can I modify it. Any help appreciated!

--- update ---

Basing on procID from logcat now i know that package: com.samsung.android.mobileservice is responsible for this hash checking. After code investigation I found that the file with hashes is located here:

/data/data/com.samsung.android.mobileservice/files/package_info.xml

and in that file we can find this entries related to com.sec.android.app.samsungapps:

<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[-109254120]]></signature>
<signature2><![CDATA[]]></signature2>
</packageInfo>
....
<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[-965053021]]></signature>
<signature2><![CDATA[]]></signature2>
</packageInfo>
...
<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[2040106259]]></signature>
<signature2><![CDATA[c67d72638ec349719fea61118b32f06eb96125b3d687f3d6c521e34f669703e2]]></signature2>
</packageInfo>

signature2 in last entry length is equal to sha256 hash

Below is full function of hash checking:

private static boolean checkSignature2Validation(Context paramContext, ArrayList<PackageSignatureInfo> paramArrayList, String param_appID, String param_packageName, boolean paramBoolean)
throws PackageManager.NameNotFoundException
{
String[] arrayOfString = null;
Signature[] arrayOfSignature = paramContext.getPackageManager().getPackageInfo(param_packageName, 64).signatures;
int i;
int k;
if ((arrayOfSignature != null) && (arrayOfSignature.length > 0))
{
arrayOfString = new String[arrayOfSignature.length];
i = 0;
int j = arrayOfSignature.length;
for (k = 0;; k++)
{
paramContext = arrayOfString;
if (k >= j) {
break;
}
arrayOfString[i] = HashUtil.getSHA256(arrayOfSignature[k].toCharsString());
LogUtil.getInstance().logD(param_packageName + ", sha2Arr[i]:" + arrayOfString[i]);
i++;
}
}
LogUtil.getInstance().logI("AccountResponse", "sigs is empty");
paramContext = arrayOfString;
boolean bool = false;
if (paramContext != null) {
bool = isSHA2Matched(paramArrayList, param_appID, paramContext, param_packageName, paramBoolean);
}
if (!bool)
{
LogUtil.getInstance().logI("AccountResponse", "hash value or app id of this apk is not registered. plz register!!!!!!!");
LogUtil.getInstance().logD("AccountResponse", "appID : " + param_appID);
if (paramContext != null)
{
i = paramContext.length;
for (k = 0; k < i; k++)
{
paramArrayList = paramContext[k];
LogUtil.getInstance().logI("AccountResponse", "wrong hashcode : " + RestrictionStringRemovalUtil.getInstance().getAvailableKeyString(param_packageName) + "/" + hashCodeToLog(paramArrayList));
}
}
}
return bool;
}

Can i somehow retrieve value of paramContext.getPackageManager().getPackageInfo(param_packageName, 64).signatures; with ADB to confirm my guess?