Skip to content

[SMS] Add functionality for SMS Retriever API #170 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Ce3apyc opened this issue Mar 8, 2024 · 11 comments
Closed

[SMS] Add functionality for SMS Retriever API #170 #215

Ce3apyc opened this issue Mar 8, 2024 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@Ce3apyc
Copy link

Ce3apyc commented Mar 8, 2024

Description
SMS Retriever API doesn't work with APK Signature Scheme v3.1

Error messages
SMSRetriever starts with no error message, with ASuccess=True, when SMS comes, nothing happens.

Please indicate
All android versions

Steps To Reproduce
Install your app from Google Play store.

Hi! I'm writting you considering your post here https://githubissues.com/DelphiWorlds/Kastri/170. Sorry for my bad English, I'm also new to github, so please don't scold me too much if I'm asking a question in the wrong place.

I have implemented your example in my app, and it works just fine if I'm signing apk by myself, but when I install my app from Google Play store, it doesn't work. I have compared signature information (given from apksigner verify -print-certs -v package.apk command) from both cases and it turned out, that the main difference is that Google is now using APK Signature Scheme v3.1. Could you consider to update SMSRetrieverTest.zip and/or AppHashGen.zip to fix this issue?

@DelphiWorlds DelphiWorlds self-assigned this Mar 8, 2024
@DelphiWorlds DelphiWorlds added the enhancement New feature or request label Mar 8, 2024
@DelphiWorlds
Copy link
Owner

Please indicate which app on Play Store you are referring to (if it is public, and available in Australia), and indicate what you mean by "doesn't work". Also, please provide links and/or documentation regarding "Google is now using APK Signature Scheme v3.1."

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 8, 2024

The app is called БСПТ. I have just made it available in Australia. "doesn't work" means SMSRetriever doesn't catch SMS containing hash created by your tool AppHashGen.zip (SMSRetriever.OnSMSResult is not called at all).

Sorry, but my judgements regarding "Google is now using APK Signature Scheme v3.1." are only based on comparison mentioned earlier of apk signature information given from apksigner verify -print-certs -v package.apk command. There is a line there "Verified using v3.1 scheme (APK Signature Scheme v3.1): true" and the value "true" only comes with newly uploaded or updated to Google Play store apps. I only managed to find this link.

Forgot to mention that Google says: If you are already using the apksigner tool to display the certificate lineage information, you must use the tool from Android SDK ver. 33.0.1 and above.

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 8, 2024

The additional info that might help: There is an untilty called APK-Info according to this it should be able to verify signature of the apk by using APK Signature Scheme v3, but it can not, and it gives this error: "Unknown additional attribute: ID 0x559f8b02"

@DelphiWorlds
Copy link
Owner

I've updated the original SMS Retriever test app to add code that can obtain the app hash within itself. You can deploy a version of your app for internal testing on Play Store, install it from there and invoke the code to determine the app hash. You could remove that code if you feel you need to before publishing the version you intend to release.

The code to call (as per code in Unit1 of the attached demo) is: SMSRetriever.GetApplicationHash

SMSRetrieverTest.zip

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 10, 2024

Thank you. Does it mean that your tool AppHashGen.zip doesn't give the right hash any more? And the only way to get the right hash is within the app?
Is it save to use the latest versions of play-services-auth jars?

@DelphiWorlds
Copy link
Owner

Does it mean that your tool AppHashGen.zip doesn't give the right hash any more?

It appears it does not.

Is it save to use the latest versions of play-services-auth jars?

The latest version of play-services-auth-base (v18.0.11) has a dependency on play-services-basement v18.2.0, and Delphi uses v18.1.0, so possibly not, but that does not mean it will not work

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 10, 2024

How do you compute hash within the app?

@DelphiWorlds
Copy link
Owner

How do you compute hash within the app?

As per my earlier comment:

The code to call (as per code in Unit1 of the attached demo) is: SMSRetriever.GetApplicationHash

The code that computes the hash is in the DW.Android.AppSignatureHelper unit, included with the project

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 11, 2024

After opening this demo project closing the studio causes this error:
image

@DelphiWorlds
Copy link
Owner

I doubt this error is related to the project itself. It does not have any special components in it, or anything

@Ce3apyc
Copy link
Author

Ce3apyc commented Mar 12, 2024

I've updated the original SMS Retriever test app to add code that can obtain the app hash within itself. You can deploy a version of your app for internal testing on Play Store, install it from there and invoke the code to determine the app hash. You could remove that code if you feel you need to before publishing the version you intend to release.

The code to call (as per code in Unit1 of the attached demo) is: SMSRetriever.GetApplicationHash

SMSRetrieverTest.zip

That helped. But hasn’t Google really provided a more convenient way for developers to obtain the application hash? Isn't that weird?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants