我怎样才能prevent任何人,除了我的Andr​​oid应用程序与我的服务器进行通信我的、应用程序、通信、服务器

2023-09-05 07:59:26 作者:闹钟你别闹

我在谷歌应用程序引擎休息的服务器,我想只有我的应用程序才能够拨打电话到我的服务器。

有一个安全的选择,我可以打开在谷歌应用引擎将faciliate吗?如果不是我能做些什么?

我知道你可以限制访问某些网页与follwing,但我不知道它可以应用到REST调用

 <安全约束>
        <网络资源收集和GT;
            < URL模式> / cron的/ *< / URL模式>
        < /网络资源收集和GT;
        <身份验证约束>
            <角色名称>管理< /角色名称>
        < / AUTH约束>
< /安全约束>
 

解决方案

生成privatekey /公钥对的OpenSSL的。在应用程序分发分配公共密钥。有一个叫做的appName自定义HTTP报头和加密应用程序的名字(一个独特的恒定联合国predicatable位大的数字),并发送。确保你的code进行模糊处理,使没有人可以查看应用程序的名字。然后,因为你是加密的,即使有人跟踪的HTTP调用,应用程序的名字将作为加密值可见。在服务器端使用私钥解密的应用程序的名字。希望这有助于。

I got a rest server on Google app engine and I want only my app to to be able to make calls to my server.

Is there a security option I can turn on on Google app engine that will faciliate this? if not than what can I do?

I know you can restrict access to some pages with the follwing but i am not sure it can be applied to REST calls

<security-constraint>
        <web-resource-collection>
            <url-pattern>/cron/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>admin</role-name>
        </auth-constraint>
</security-constraint>

解决方案

Generate privatekey/publickey pair in openssl. In app distribution distribute public key. Have a custom http header called appName and encrypt the appname (a unique constant unpredicatable bit large number) and send it. Ensure your code is obfuscated so that no one is able to view the appname. Then since you are encrypting even if someone traces the http calls, the appname will be visible as encrypted value. At your server end decrypt the appname using private key. Hope this helps.