How SHA and SHA1 certificates secure an API on your Android app like Facebook does?

馋奶兔 提交于 2019-12-06 04:21:40

Facebook is leveraging Android application signing functionality to provide the same type of assurance in the context of API interactions.

When building your application, your private key is being used to digitally sign the result. The signature validates that the build was created by the key owner and not subsequently modified.

Within the application, a signing certificate is stored, which is programmatically accessible.

In the Facebook SDK, the signing certificate is extracted using the PackageManager class. The resultant keyhash is provided as a parameter to API calls, where it is compared with the hash you provided via their Developer ste.

So, by providing the keyhash out-of-band (i.e. exporting it and entering on the developer site), Facebook is able to validate the in-band instance (i.e. compiled into the application and included in API requests).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!