SHA和SHA1证书如何像Facebook一样确保Android应用程序上的API的安全? [英] How SHA and SHA1 certificates secure an API on your Android app like Facebook does?

查看:254
本文介绍了SHA和SHA1证书如何像Facebook一样确保Android应用程序上的API的安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道什么是SHA和SHA1加密算法.我也知道如何从计算机上对它们进行修饰.

但是我在互联网上进行了很多搜索,但是仍然无法获得有关如何使用这些密钥来保护您在Android应用中使用的API的正确解释?

例如,Facebook需要在系统的开发者控制台上输入系统中的SHA1密钥以及应用程序的软件包名称,如果输入的密钥错误,则它们的API在您的应用程序上将不起作用.

此机制如何运作?他们如何在您的应用程序上对此进行验证?

解决方案

Facebook正在利用 Android应用程序签名功能以在API交互的上下文中提供相同类型的保证.

在构建应用程序时,您的私钥用于对结果进行数字签名.签名确认该构建是由密钥所有者创建的,随后未进行修改.

在应用程序中,存储了签名证书,该签名证书可以通过编程方式访问.

在Facebook SDK中, noreferrer> PackageManager类.生成的密钥哈希为作为API调用的参数提供,在此与 解决方案

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).

这篇关于SHA和SHA1证书如何像Facebook一样确保Android应用程序上的API的安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆