After having read a lot of topics, and questions on stackoverflow about how to access external databases (MySQL) through an Android app, my question is : How to make sure that only MY app will be able to retrieve data from that DB? It's all about security.

在阅读了大量的主题和stackoverflow上关于如何通过Android应用程序访问外部数据库(MySQL)的问题之后,我的问题是:如何确保只有我的应用程序才能从那个DB中检索数据?这都是为了安全。

In order to access that DB, I intend to make a little PHP file on my server that will be used as an interface between my app and my DB. But, if anybody can see the URL used, then he will also be able to interact with my DB. So, how can I prevent that?

为了访问这个DB,我打算在我的服务器上创建一个PHP文件,它将用作我的应用程序和DB之间的接口。但是,如果任何人都能看到使用的URL,那么他也将能够与我的数据库交互。那么,我该如何预防呢?

Thank you.

谢谢你!

2 个解决方案

#1


3

First of All I would recommend You to use HTTPS transfer protocol to be honest even self-signed certificate secured with secret (having special signs etc.) is a good protection.

首先,我建议您使用HTTPS传输协议,要诚实,即使是带有保密(有特殊标志等)的自签名证书也是很好的保护。

Then You create web service on your server which validate this certificate (make sure you don't hard code certificate secret) and voila.

然后在您的服务器上创建web服务,该服务验证这个证书(确保您没有硬编码证书机密)。

EDIT

编辑

Assuming You are talking about android I will provide You with keytool tutorial Here. I assume also that You are aware that You have to create custom HTTPS handler in order to put certificate in the request if You don't knew how to do it I can post it as soon as I came to home (I have my project on my private computer). Part with server-side certificate validation is Here

假设您正在讨论android,我将在这里提供keytool教程。我还假设您知道,您必须创建自定义HTTPS处理程序,以便将证书放入请求中,如果您不知道如何做到这一点,我可以在我回到家后立即将其发布(我的项目在我的私人计算机上)。服务器端证书验证部分在这里

更多相关文章

  1. 制作一个基本的angularjs应用程序对我不起作用,我也不知道为什么
  2. Emberjs应用程序加载除Index之外的所有路由
  3. 在Android上使用离子崩溃而不是ios构建的混合应用程序
  4. 没有'Access-Control-Allow-Origin'反应表达docker应用程序
  5. 如何测试从实时网站提取数据的AJAX应用程序?
  6. 如何在单击按钮时将桌面应用程序导航到系统中设置的默认邮件提供
  7. Angular 2快速入门 - 我的应用程序组件未加载
  8. 如何访问远程节点。浏览器中的js应用程序,而不是本地主机
  9. 如果外部应用程序更改了持久模型(服务器数据库),AngularJS可以自

随机推荐

  1. android studio 4.0. gradle 4.0. tinker
  2. Android(安卓)- ToDoList(fragment) 详解
  3. Android中的ellipsize
  4. Android利用系统广播---监听应用程序安装
  5. Android 中的数据库 SQLite
  6. Android(安卓)+NDK+eclipse+opengl ES2.0
  7. Android(安卓)Studio 上如何使用LogCat
  8. Android(安卓)删除sdcard目录中的某些目
  9. unity3d连接Sqlite并打包发布Android
  10. Android(安卓)APP启动过程中应用代码的加