Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 给安卓写的调用接口 如何保证安装性,防止攻击

给安卓写的调用接口 如何保证安装性,防止攻击

Jun 23, 2016 pm 01:42 PM

给安卓写的调用接口 如何保证安装性,防止攻击,有的说要用oauth2.0   查了一下关于oauth2.0的资料 看不明白咋用  请教大家指点一下


回复讨论(解决方案)

微信 微博 对外开放很多的API 接口  是如何保证其安全性的  如何预防攻击的

看你是自己的内部接口还是对外接口,一般都需要有签名 这个是至少的 敏感数据可以加密,如果是服务器网络上的防范攻击 可以加入一些比如一分钟的请求次数  IP的管理  帐号的管理 等等 措施来进行防范。

目前来说 针对接口进行攻击的行为 至少我还没有碰到 或许是攻击的量太小了不足以引起注意吧

加密,解密。
把传递的参数加密(token)。然后在服务器端解密。

require 'aes.class.php';require 'aesctr.class.php';$key = 'abcdef'; // 密钥$param = array(    'name' => 'fdipzone',    'password' => '123456',    'time' => time())$token = AesCtr::encrypt(json_encode($param), $key, 256); // 加密// 服务器接收后$data = json_decode(AesCtr::decrypt($token, $key, 256), true);
Copy after login
Copy after login


'aes.class.php aesctr.class.php 参考: http://blog.csdn.net/fdipzone/article/details/8178982

看你是自己的内部接口还是对外接口,一般都需要有签名 这个是至少的 敏感数据可以加密,如果是服务器网络上的防范攻击 可以加入一些比如一分钟的请求次数 IP的管理 帐号的管理 等等 措施来进行防范。

目前来说 针对接口进行攻击的行为 至少我还没有碰到 或许是攻击的量太小了不足以引起注意吧

谢谢版主的回答 这个是对外开放接口让安卓调用 比如说表单提交 通过接口提交给后台 防止别人知道接口后恶意提交

加密,解密。
把传递的参数加密(token)。然后在服务器端解密。

require 'aes.class.php';require 'aesctr.class.php';$key = 'abcdef'; // 密钥$param = array(    'name' => 'fdipzone',    'password' => '123456',    'time' => time())$token = AesCtr::encrypt(json_encode($param), $key, 256); // 加密// 服务器接收后$data = json_decode(AesCtr::decrypt($token, $key, 256), true);
Copy after login
Copy after login


'aes.class.php  aesctr.class.php 参考: http://blog.csdn.net/fdipzone/article/details/8178982

  谢谢fdipzone的回答   我去看看
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to avoid attacks such as image Trojans in PHP language development? How to avoid attacks such as image Trojans in PHP language development? Jun 09, 2023 pm 10:37 PM

With the development of the Internet, cyber attacks occur from time to time. Among them, hackers using vulnerabilities to carry out image Trojan and other attacks have become one of the common attack methods. In PHP language development, how to avoid attacks such as image Trojans? First, we need to understand what a picture Trojan is. Simply put, image Trojans refer to hackers implanting malicious code in image files. When users access these images, the malicious code will be activated and attack the user's computer system. This attack method is common on various websites such as web pages and forums. So, how to avoid picture wood

PHP security programming in 30 words: Preventing request header injection attacks PHP security programming in 30 words: Preventing request header injection attacks Jun 29, 2023 pm 11:24 PM

PHP Security Programming Guide: Preventing Request Header Injection Attacks With the development of the Internet, network security issues have become increasingly complex. As a widely used server-side programming language, PHP's security is particularly important. This article will focus on how to prevent request header injection attacks in PHP applications. First, we need to understand what a request header injection attack is. When a user communicates with the server through an HTTP request, the request header contains information related to the request, such as user agent, host, cookie, etc. And the request header injection attack

How to prevent SQL injection attacks in PHP language development? How to prevent SQL injection attacks in PHP language development? Jun 10, 2023 pm 09:43 PM

In the process of website development, SQL injection attack is a common security vulnerability, which allows attackers to obtain sensitive data of the website or control the website by maliciously injecting SQL code. PHP is a commonly used back-end language. The following will introduce how to prevent SQL injection attacks in PHP language development. Using parameterized queries A parameterized query is a SQL statement that uses placeholders. The data is separated from the placeholders through the precompilation stage, which improves the security of the SQL statement. In PHP, you can use PDO (PH

Network security development practice: LDAP injection attack prevention skills Network security development practice: LDAP injection attack prevention skills Jun 30, 2023 pm 03:28 PM

Website Security Development Practice: How to Prevent LDAP Injection Attacks Introduction: With the development of the Internet, website security issues have attracted more and more attention. Among them, LDAP (Lightweight Directory Access Protocol) injection attack is a common security vulnerability, which can lead to the leakage of users' sensitive information and even the system being invaded. This article will introduce the principles of LDAP injection attacks and provide some best practices for preventing LDAP injection attacks. Understand the principles of LDAP injection attacks. LDAP injection attacks refer to hackers using LDAP query words entered by users.

Nginx security configuration guide to prevent website attacks and malicious access Nginx security configuration guide to prevent website attacks and malicious access Jul 04, 2023 pm 02:42 PM

Nginx Security Configuration Guide to Prevent Website Attacks and Malicious Access Introduction: With the rapid development of the Internet, network security issues have attracted more and more attention. As a website administrator, it is crucial to protect your website from attacks and malicious access. As a high-performance web server and reverse proxy server, Nginx provides a wealth of security configuration options that can help us strengthen the security of our website. This article will introduce some commonly used Nginx security configurations to help website administrators prevent website attacks and malicious access. 1. Restrictions on access

PHP Security Guide: Preventing HTTP Response Splitting Attacks PHP Security Guide: Preventing HTTP Response Splitting Attacks Jul 01, 2023 pm 01:37 PM

PHP Security Guide: Preventing HTTP Response Splitting Attacks Introduction: In today's Internet era, network security issues have attracted much attention. As websites and applications continue to evolve, attackers have also discovered new vulnerabilities and attack techniques, resulting in the security of many web applications being compromised. One of them is the HTTP response splitting attack, which allows unauthorized users to obtain sensitive system information or perform unauthorized operations. This article will introduce the principles of HTTP response splitting attacks and provide some PHP programming tips to help

Website security development practices: How to prevent request forgery attacks Website security development practices: How to prevent request forgery attacks Jun 29, 2023 am 10:01 AM

In today's digital era, websites have become an indispensable part of people's lives. However, with the popularity of websites and the increase in functions, website security issues have also become the focus of attention. Among them, request forgery attack is a common security threat, which may lead to serious consequences such as user information leakage and account theft. In order to protect the security of user data, website developers need to practice a series of security measures to prevent request forgery attacks from occurring. First of all, website developers should understand the principles and common attack methods of request forgery attacks.

Preventing Session Fixation Attacks: Improving Java Security Preventing Session Fixation Attacks: Improving Java Security Jun 30, 2023 am 08:21 AM

Java is a widely used programming language that is widely used in Internet applications and large enterprise systems. However, due to its breadth and complexity, Java systems are often targeted by hackers. Session fixation attacks are a common attack method in which hackers gain access to users by hijacking their session tokens. This article will introduce the principles and preventive measures of session fixation attacks to help Java developers enhance system security. A session fixation attack is an attack that uses session tokens to gain user privileges. In Ja

See all articles