duanrang9348 2013-04-14 08:03
浏览 16
已采纳

如何在PHP中保护发布请求和响应

I am using curl post to exchange data between my three sites. I need to secure the data exchange by confirming whether the POST request in sent from either of my three sites.

Right now I have implemented the request header check but the request headers can also be manipulated. Is there a fool proof way to achieve this?

  • 写回答

1条回答 默认 最新

  • dongwenhui8900 2013-04-14 08:32
    关注

    I'm working on a RESTful service and also think about how I ensure the communication between service and authorized clients. After lengthy research I decided on the following solution.

    Each client (application) has a public ID and a private key. The public ID can be up. The private key, only the client and the service know.

    With each request, the client must authenticate it does with HTTP Basic Authentication. The username is the public ID. The password is a SHA1 token. The token is generated by the combination of the public ID, the transmitted parameters and the private key.

    When the service receives a request, he knows by the username which client has made ​​this request. It generates a token with the same method and compares it with the password. Are the two token identical, the client is entitled to make the request. Additionally, it is ensured that the parameters are not manipulated.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路